Ustawia typ kontentu odpowiedzi (content-type
@param string $type nazwa typu np. jpg, gif, html, lub text/html
@param boolean $replace zastąpienie
@return \Mmi\Http\Response
188374
public function setType($type, $replace = false)
    {
        //usuwanie typu odpowiedzi
        $this->_type = ResponseTypes::searchType($type);
        //wysłanie nagłówka
        return $this->setHeader('Content-type', $this->_type, $replace);
    }
1010706
public function headMeta(array $params = [], $replace = false, $conditional = '')
    {
        //jeśli brak parametrów - wyjście
        if (empty($params)) {
            return $this;
        }
        //warunek
        $params['conditional'] = $conditional;
        if (!array_key_exists(reset($params), $this->_data) || $replace) {
            //wstawienie pod danym kluczem
            $this->_data[reset($params)] = $params;
        }
        return '';
    }
848396
private function replaceMatches($type, $pattern, $subject, $responseBody)
    {
        $matches = [];

        $matchCount = preg_match_all(
            $pattern,
            $subject,
            $matches
        );

        if ($matchCount > 0) {
            // we don't need full matches
            unset($matches[0]);
            $responseBody = $this->replaceMatchesInBody($matches, $type, $responseBody);
        }

        return $responseBody;
    }
1080224
protected static function cleanType($type)
    {
        $type = str_replace([
            "\r",
            "\n",
            "\t",
            '{',
            '}',
            '[',
            ']',
            ';',
        ], '', $type);
        $type = preg_replace('/[\s]+/', ' ', $type);
        return trim($type);
    }
947007
public function generateText($type = 'html', $content = array())
    {
        $apiCall = '/helper/generate-text';
        $payload = array(
            'type'      => $type,
            'content'   => $content
        );

        $data = $this->requestMonkey($apiCall, $payload);
        $data = json_decode($data, true);
        if (isset($data['error']))
            throw new MailchimpAPIException($data);
        else
            return $data;
    }
344790
public function insertGetId(array $data, $replace = false, $sequence = null)
    {
        return $this->insert($data, $replace, true, $sequence);
    }
537451
public function replace(string $regex, string $replacement) : Text
    {
        return $this->pipe(
            function (string $value) use ($regex, $replacement) {
                return preg_replace($regex, $replacement, $value);
            }
        );
    }
787633
public static function replace(String $file, $data, $replace) : String
    {
        $file = Info::rpath($file);

        if( ! is_file($file))
        {
            return false;
        }

        return Filesystem::replaceData($file, $data, $replace);
    }
1148390
public function display( $sendContentType = TRUE )
	{
		if( $sendContentType )
			header( 'Content-type: '.$this->getMimeType() );
		switch( $this->getType() )
		{
			case IMAGETYPE_GIF:
				imagegif( $this->resource );
				break;
			case IMAGETYPE_JPEG:
				imagejpeg( $this->resource, NULL, $this->quality );
				break;
			case IMAGETYPE_PNG:
				imagepng( $this->resource );
				break;
			default:
				header_remove( 'Content-type' );
				new UI_Image_Error( 'invalid type' );
		}
	}
886661
public static function replaceWith($replacement): callable
    {
        return function (&$val) use ($replacement) : bool{
            if (empty($val)) {
                $val = $replacement;
            }

            return true;
        };
    }
164969
public static function view($type = 'block') {
    $build = array();

    $view = Views::getView('site_press_centre_last');
    $content = '';
    if (is_object($view)) {
      $view->setDisplay($type);
      $content = $view->buildRenderable();
    }

    // Создает HTML отображение материалов.
    $build['site_press_centre'] = array(
      '#theme' => 'site_press_centre',
      '#content' => $content,
    );

    return $build;
  }
685771
public function save($file, $replace = true) {
        $header['Content-Type'] = $file['type'];
        $header['Content-MD5'] 	= $file['md5'];
        $header['Mkdir'] = 'true';
        $resource = fopen($file['tmp_name'], 'r');

        $save = $this->rootPath . $file['savepath'] . $file['savename'];
        $data = $this->request($save, 'PUT', $header, $resource);
        return false === $data ? false : true;
    }
300014
public function run($type = 'all')
    {
        $cleanDivision = false;
        $this->stdout("clean {$type}:\n", Console::FG_GREEN);
        switch ($type) {
            case 'all':
                foreach ($this->ipv4->getQueries() as $name => $query) {
                    if (DatabaseQuery::is_a($query)) {
                        $cleanDivision = true;
                    }
                    $this->clean($query, $name);
                }
                break;
            case 'file':
                foreach ($this->ipv4->getQueries() as $name => $query) {
                    if (FileQuery::is_a($query)) {
                        $this->clean($query, $name);
                    }
                }
                break;
            case 'database':
                foreach ($this->ipv4->getQueries() as $name => $query) {
                    if (DatabaseQuery::is_a($query)) {
                        $cleanDivision = true;
                        $this->clean($query, $name);
                    }
                }
                break;
            default:
                $this->stderr("Unknown type \"{$type}\".", Console::FG_GREY, Console::BG_RED);
                break;
        }
        if ($cleanDivision) {
            $this->cleanDivision();
        }
    }
670711
public function addReplace($replace, $version = '*', $overwrite = false)
    {
        if (!isset($this->getReplace()->$replace) || $overwrite) {
            $this->getReplace()->$replace = $version;
        }

        return $this;
    }
88435
public function get($type, array $default = [], $remove = true)
    {
        if ($this->has($type)) {
            if (true === $remove) {
                unset($this->messages[$type]);
            }

            return $this->messages[$type];
        }

        return $default;
    }
370554
private function convert($type, $reverse = false)
    {
        $replace = array_merge(
            $this->getJpgReplace(),
            $this->getBmpReplace()
        );

        if ( $reverse ) {
            $replace = array_flip($replace);
        }

        return str_replace(array_keys($replace), array_values($replace), $type);
    }
556727
public static function copyFile($source,$dest,$replace=false)
    {
        $dir=dirname($dest);
        if (!file_exists($dir)){//如果文件夹不存在
            self::createDir(dirname($dir));    //取得最后一个文件夹的全路径返回开始的地方
            mkdir($dir, 0777);
            chmod($dir,0777);
        }
        if(file_exists($dest)){
            if($replace)
                unlink($dest);
            else
                return false;
        }
        return copy($source,$dest);
    }