Reads a user input
@param string $format
@return string
183545
public function in($format = '')
    {
        if (empty($format)) {
            $line = fgets(STDIN);
        } else {
            $line = fscanf(STDIN, $format . PHP_EOL, $line);
        }

        return trim($line);
    }
978393
protected function outputContentType($format)
    {
        if (!isset($format)) {
            $contentType = $this->getResponse()->getHeaderLine('Content-Type');
            
            if (empty($contentType)) {
                $format = $this->defaultFormat ?: 'text/html';
            }
        }
        
        if (empty($contentType)) {
            $contentType = $this->getContentType($format);
            $this->setResponseHeader('Content-Type', $contentType);
        }
        
        return $contentType;
    }
430347
public function getCode($format)
    {
        foreach ($this->codes as $code) {
            if ($code->getFormat() == $format) {
                return $code;
            }
        }
    }
1308616
public function get($format = self::TERMINAL_PNG)
    {
        $this->sendInit();
		$this->sendCommand("set terminal $format size {$this->width}{$this->unit}, {$this->width}{$this->unit}");
        fflush($this->stdout);
        $this->plot();

        // Reading data, timeout=100ms
        $result = '';
        $timeout = 100;
        do {
            stream_set_blocking($this->stdout, false);
            $data = fread($this->stdout, 128);
            $result .= $data;
            usleep(5000);
            $timeout-=5;
        } while ($timeout>0 || $data);

        return $result;
    }
432204
public static function translateSwaggerFormats($format)
    {
        switch (strtolower(preg_replace('/\\\\/im', '', $format))) {
            case 'bool':
            case 'boolean':
                $swaggerType = 'boolean';
                $swaggerFormat = '';
                break;
            default:
            case 'string':
            case 'varchar':
                $swaggerType = 'string';
                $swaggerFormat = '';
                break;
            case 'binary':
            case 'varbinary':
                $swaggerType = 'string';
                $swaggerFormat = 'password';
                break;
            case 'int':
            case 'integer':
                $swaggerType = 'integer';
                $swaggerFormat = 'int32';
                break;
            case 'float':
            case 'double':
                $swaggerType = 'number';
                $swaggerFormat = strtolower($format);
                break;
            case 'date':
                $swaggerType = 'string';
                $swaggerFormat = 'date';
                break;
            case 'timestamp':
            case 'datetime':
                $swaggerType = 'string';
                $swaggerFormat = 'date-time';
                break;

        }
        return [$swaggerType, $swaggerFormat];
    }
177096
public function getFormattedImage($format)
    {
        $formatName = $format instanceof FormatInterface
            ? $format->getName()
            : $format
        ;

        return $this->formattedImages
            ->filter(function (FormattedImageInterface $formattedImage) use ($formatName) {
                return ($format = $formattedImage->getFormat())
                    && $format->getName() == $formatName
                ;
            })
            ->first() ?: null // first() returns "false" if collection empty
        ;
    }
58616
function parseResponse($response, $format) {
		if (isset ( $format )) {
			switch ($format) {
				case "pdf" :
					$theResponse = $response;
					break;
				case "json" :
					$theResponse = json_decode ( $response, true );
					break;
				default :
					$theResponse = simplexml_load_string ( $response );
					break;
			}
		}
		return $theResponse;
	}
462831
public function format($format = null)
    {
        if (!$format) {
            $format = $this->getFormat();
        }

        return parent::format($format ?: static::$toStringFormat);
    }
745542
static public function getDiffReaderByFormat( $format )
    {
        if ( !isset( self::$diffReadHandlers[$format] ) )
        {
            throw new ezcDbSchemaUnknownFormatException( $format, 'difference read' );
        }
        return self::$diffReadHandlers[$format];
    }
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';
  }
1312634
public function format($format = null)
    {
        if (empty($format)) {
            $format = $this->defaultFormat;
        }
        return $this->formatDatetimeObject($format);
    }
710825
public function toString($format = null) {
        // If no format is defined, use the one specified in the current class
        if (!isset($format)) {
            $format = self::DATETIME_FORMAT;
        }

        return $this->_dateTime->format($format) . '.' . self::_formatMilliseconds($this->_milliseconds);
    }
76974
public function getMetaDateFormatted($format = null)
    {
        if ($this->owner->hasMetaDate()) {
            return $this->owner->getMetaDate()->Format($format ? $format : $this->owner->getMetaDateFormat());
        }
    }
729063
function printFormatted(string $format): int {
		$args = func_get_args ();
		$s = call_user_func_array ( 'sprintf', $args );
		return $this->write ( $s );
	}
1094954
public function toString(string $format = null) : string
    {
        $operations = $this->operations;
        $operations[] = [ 'getImage', [ $format ] ];
        
        $driver = $this->getDriver();
        return array_reduce($operations, function ($carry, $item) use ($driver) {
            return $driver->{$item[0]}(...$item[1]);
        });
    }
546496
public function getApiURL($format = null)
    {
        $apiUrl = str_replace(['.'.$this->format, '?limit=0'], '', $this->apiURL);
        return $apiUrl.(empty($format) ? '' : '.'.$format );
    }
1165661
private static function parseFromFormat(string $input, string $format)
    {
        $parsedOrNull = null;

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

        return $parsedOrNull;
    }