@param array[string]mixed $arguments extra arguments to be passed to the api call
@param string             $format    override format (defaults to one specified in config file)

@return mixed
2014
public function getProvider($arguments = [], $format = null)
    {
        $options = $this->getOptions($format)->setArguments($arguments);

        return $this->request->send($options);
    }
466522
protected function applyCustomFormat($format, $data)
    {
        $aClassFunc = $this->getFuncParams($format);

        $params = array_key_exists(
            'params',
            $format
        ) ? $format['params'] : [];

        array_unshift($params, $data);

        $object = (new \ReflectionClass($aClassFunc['class']))->newInstance();

        $data = call_user_func_array([$object, $aClassFunc['method']], $params);

        return $data;
    }
299595
public function setFormat($format) {
        if ($format === null) {
            $format = [];
        } else if ( ! is_array($format)) {
            $format = [$format];
        }

        $this->format = $format;

        return $this;
    }
984600
public function setFormat($format)
    {
        if (!in_array($format, $this->formats)) {
            $msg = "The '%s' format is not allowed. Try with '%s'";
            throw new InvalidArgumentException(sprintf($msg, $format, implode("', '", $this->formats)));
        }

        $this->format = $format;

        return $this;
    }
696438
public function get($format)
    {
        switch ($format) {
            case 'json':
                return $this->toJson();
                break;
            case 'serialize':
                return $this->serialize();
                break;
            case 'array':
                return $this->toArray();
                break;
            case 'xml':
                return $this->toXml();
                break;
            default:
                return $this;
        }
    }
268747
private function convertFormat($format)
    {
        if (is_array($format)) {
            // sounds like the format is already done, let's keep it as it is
            return $format;
        }
        if (array_key_exists($format, $this->formats)) {
            // it's a format defined in config, let's use all defined parameters
            return $this->formats[$format];
        } elseif (preg_match("/^([0-9]*)x([0-9]*)/", $format)) {
            // it's a custom [width]x[height] format, let's make a thumb
            return array('thumbnail' => $format);
        } else {
            throw new InvalidArgumentException(sprintf("Unknown IM format: %s", $format));
        }
    }
1161388
public function format($format) {

		if(false === is_string($format)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($format)), E_USER_ERROR);
		}

		$this -> format = $format;

		return $this;
	}
528053
public function to($format, array $options = []) {
		$this->offsetGet(null);
		return parent::to($format, $options);
	}
594028
public function format(?string $format = null, array $config = []): self
    {
        if (! \is_null($format) && ! empty($format)) {
            $this->setFormat($format);

            if (! empty($config)) {
                $this->when($format, $config);
            }
        }

        return $this;
    }
266807
public function getWidgetMetadata($format = null)
    {
        $options = $this->getOptions($format)
            ->usePeriod(false);

        return $this->request->send($options);
    }
1223888
protected function getExportOption($key, $format)
    {
        if ('1.2.xliff' !== $format) {
            return;
        }

        $translate = true;

        if (in_array(
            $key,
            $this->seoAttributes
        )) {
            $translate = false;
        }

        return [
            'translate' => $translate,
        ];
    }
1165661
private static function parseFromFormat(string $input, string $format)
    {
        $parsedOrNull = null;

        if (($value = DateTimeImmutable::createFromFormat($format, $input)) !== false) {
            $parsedOrNull = $value;
        }

        return $parsedOrNull;
    }
1131161
public function format($data, $format)
    {
        // Case handing. ex. json => Json
        $format = ucfirst(strtolower($format));
        $formatFunc = "format" . $format;
        // Use formatter if exists
        if (method_exists($this, $formatFunc)) {
            
            $data = $this->{$formatFunc}($data);
        } 
        elseif (is_array($data)) {
            // Use JSON while the Formatter not found and the data is array
            $data = $this->formatJson($data);
        }

        return $data;
    }
1102906
protected static function format(array $data, $format)
    {
        $format = strtolower($format);
        switch ($format) {
            case static::CONTENT_TYPE_FORM:
                return http_build_query($data);
            case static::CONTENT_TYPE_JSON:
                return json_encode($data);
            default:
                throw new InvalidArgumentException('Format not supported');
        }
    }
513393
public function parseFormat($format)
  {
    $this->keys = array();

    $regex = '';
    $curr = '';
    $beforeGroup = '';
    $afterGroup = '';

    $split = str_split($format);
    $count = count($split);
    for ($i=0; $i<$count; $i++) {
      $c = $split[$i];
      if ($c == '{') {
        $regex .= preg_quote($curr, '/');
        $curr = '';
        if ($i+1 < $count && $split[$i+1] == '{') {
          $beforeGroup = $i != 0 ? $split[$i-1] : '';
          $i++;
          continue;
        }
      } else if ($c == '}' && ($i+1 < $count && $split[$i+1] == '}')) {
        $afterGroup = $i+2 < $count ? $split[$i+2] : '';
        $regex .= $this->parseCapturingGroup(trim($curr), $beforeGroup, $afterGroup);
        $curr = '';
        $i++;
        continue;
      }
      $curr .= $c;
    }

    if (empty($this->keys)) {
      throw new \InvalidArgumentException('$format must have at least one capturing group');
    }

    # use /s flag so that wildcard char also matches "\n"
    $this->regex = '/^' . $regex . preg_quote($curr, '/') . '$/s';
  }
1168831
public function get($format = null)
    {
        if ( ! is_null($format) )
            $this->setFormat($format);

        ob_start();
        call_user_func($this->getFunctionName(), $this->getImage());

        return ob_get_clean();
    }
721492
public static function registerFormat( $format )
    {
        $object = new $format();
        if(!($object instanceof FormatInterface)) {
            return false;
        }

        foreach ( forward_static_call(array($format, 'getFormats')) as $type ) {
            array_push(self::$supported, $type);
            self::$formatMap[$type] = $format;
        }

        return true;
    }