protected function parseFormatArgs(array $args): array
    {
        $default_args = [
            'file'   => '',
            'format' => '',

            'output_file'   => '',
            'output_format' => '',
        ];
        $args += $default_args; // Defaults.

        $args['file']          = (string) $args['file'];
        $args['output_file']   = (string) $args['output_file'];

        $args['format']        = mb_strtolower((string) $args['format']);
        $args['output_format'] = mb_strtolower((string) $args['output_format']);

        $args['format']        = $args['format'] === 'jpg' ? 'jpeg' : $args['format'];
        $args['output_format'] = $args['output_format'] === 'jpg' ? 'jpeg' : $args['output_format'];

        $args['format']        = $args['format'] ?: $this->extToFormat($args['file']);
        $args['output_file']   = $args['output_file'] ?: $this->changeFormatExt($args['file'], $args['output_format']);
        $args['output_format'] = $args['output_format'] ?: $this->extToFormat($args['output_file']);

        return $args;
    }
protected function parseFormatArgs(array $args): array
    {
        $default_args = [
            'file'   => '',
            'format' => '',

            'output_file'   => '',
            'output_format' => '',
        ];
        $args += $default_args; // Defaults.

        $args['file']          = (string) $args['file'];
        $args['output_file']   = (string) $args['output_file'];

        $args['format']        = mb_strtolower((string) $args['format']);
        $args['output_format'] = mb_strtolower((string) $args['output_format']);

        $args['format']        = $args['format'] === 'jpg' ? 'jpeg' : $args['format'];
        $args['output_format'] = $args['output_format'] === 'jpg' ? 'jpeg' : $args['output_format'];

        $args['format']        = $args['format'] ?: $this->extToFormat($args['file']);
        $args['output_file']   = $args['output_file'] ?: $this->changeFormatExt($args['file'], $args['output_format']);
        $args['output_format'] = $args['output_format'] ?: $this->extToFormat($args['output_file']);

        return $args;
    }
protected function parseFormatArgs ( array $ args ) : array { $ default_args = [ 'file' => '' , 'format' => '' , 'output_file' => '' , 'output_format' => '' , ] ; $ args += $ default_args ; // Defaults. $ args [ 'file' ] = ( string ) $ args [ 'file' ] ; $ args [ 'output_file' ] = ( string ) $ args [ 'output_file' ] ; $ args [ 'format' ] = mb_strtolower ( ( string ) $ args [ 'format' ] ) ; $ args [ 'output_format' ] = mb_strtolower ( ( string ) $ args [ 'output_format' ] ) ; $ args [ 'format' ] = $ args [ 'format' ] === 'jpg' ? 'jpeg' : $ args [ 'format' ] ; $ args [ 'output_format' ] = $ args [ 'output_format' ] === 'jpg' ? 'jpeg' : $ args [ 'output_format' ] ; $ args [ 'format' ] = $ args [ 'format' ] ? : $ this -> extToFormat ( $ args [ 'file' ] ) ; $ args [ 'output_file' ] = $ args [ 'output_file' ] ? : $ this -> changeFormatExt ( $ args [ 'file' ] , $ args [ 'output_format' ] ) ; $ args [ 'output_format' ] = $ args [ 'output_format' ] ? : $ this -> extToFormat ( $ args [ 'output_file' ] ) ; return $ args ; }
Parse format args.

@since 17xxxx Imagick utils.

@param array $args Named arguments.

@return array Parsed arguments.
Parse format args .