(non-PHPdoc)
@see Webcreate\Vcs.VcsInterface::cat()
3073
public function cat($path)
    {
        if (!$this->hasCheckout) {
            $this->checkout();
        }

        if (false === file_exists($this->cwd . '/' . $path)) {
            throw new NotFoundException(sprintf('The path \'%s\' is not found', $path));
        }

        return file_get_contents($this->cwd . '/' . $path);
    }
19887
public static function fromStringCommand($command, $cwd = null)
    {
        if (\method_exists(SymfonyProcess::class, 'fromShellCommandline')) {
            $process = SymfonyProcess::fromShellCommandline($command, $cwd);
        } else {
            $process = new SymfonyProcess($command, $cwd);
        }

        if (\method_exists(SymfonyProcess::class, 'inheritEnvironmentVariables')) {
            $process->inheritEnvironmentVariables(true);
        }

        return new self($process);
    }
1296372
public function compile($source, $destination = null, $include = null)
    {
        $include = array_merge($this->includes, (array) $include);
        
        $useCache = null == $destination && null !== $this->cache;
         
        if ($useCache) {
            if ($this->cache->hasItem($source)) {
                return $this->cache->getItem($source);
            }
        }

        $arguments = implode(' ', array_map('escapeshellarg', $this->arguments));
        $arguments .= ' ' . $this->getCommandArguments($source, $destination, $include);
        
        $command = "{$this->compiler} $arguments" . ' 2>&1'; 

        $result = exec($command, $output, $exitCode);
        if ($exitCode != 0) {
            throw new \Exception(sprintf('Error compiling CSS "%s": %s', 
                $source, 
                implode(PHP_EOL, $output)));
        }
        
        $css = implode(PHP_EOL, $output);
        
        if ($useCache) {
            $this->cache->setItem($source, $css);
        }
        
        return $css;
    }
627068
protected function getBannersByCatID($CatID = 0)
    {
        $arrBanners = array();
        
        if ($CatID == -1)
        { // all Categories
            $objBanners = \Database::getInstance()
                            ->prepare("SELECT 
                                            tb.id
                                          , tb.banner_type
                                          , tb.banner_name
                                          , tb.banner_url
                                          , tb.banner_jumpTo
                                          , tb.banner_image
                                          , tb.banner_image_extern
                                          , tb.banner_weighting
                                          , tb.banner_start
                                          , tb.banner_stop
                                          , tb.banner_published
                                          , tb.banner_until
                                          , tb.banner_comment
                                          , tb.banner_views_until
                                          , tb.banner_clicks_until
                                          , tbs.banner_views
                                          , tbs.banner_clicks
                                       FROM 
                                            tl_banner tb
                                          , tl_banner_stat tbs
                                       WHERE 
                                            tb.id=tbs.id
                                       ORDER BY 
                                            tb.pid
                                          , tb.sorting")
                            ->execute();
        }
        else
        {
            $objBanners = \Database::getInstance()
                            ->prepare("SELECT
                                            tb.id
                                          , tb.banner_type
                                          , tb.banner_name
                                          , tb.banner_url
                                          , tb.banner_jumpTo
                                          , tb.banner_image
                                          , tb.banner_image_extern
                                          , tb.banner_weighting
                                          , tb.banner_start
                                          , tb.banner_stop
                                          , tb.banner_published
                                          , tb.banner_until
                                          , tb.banner_comment
                                          , tb.banner_views_until
                                          , tb.banner_clicks_until
                                          , tbs.banner_views
                                          , tbs.banner_clicks
                                       FROM
                                            tl_banner tb
                                          , tl_banner_stat tbs
                                       WHERE
                                            tb.id=tbs.id
                                       AND
                                            tb.pid =?
                                       ORDER BY
                                            tb.sorting")
                            ->execute($CatID);
        }
        $intRows = $objBanners->numRows;
        if ($intRows > 0)
        {
            while ($objBanners->next())
            {
                $arrBanners[] = array('id'                  => $objBanners->id
                                    , 'banner_type'         => $objBanners->banner_type
                                    , 'banner_name'         => $objBanners->banner_name
                                    , 'banner_url'          => $objBanners->banner_url
                                    , 'banner_jumpTo'       => $objBanners->banner_jumpTo
                                    , 'banner_image'        => $objBanners->banner_image
                                    , 'banner_image_extern' => $objBanners->banner_image_extern
                                    , 'banner_weighting'    => $objBanners->banner_weighting
                                    , 'banner_start'        => $objBanners->banner_start
                                    , 'banner_stop'         => $objBanners->banner_stop
                                    , 'banner_published'    => $objBanners->banner_published
                                    , 'banner_until'        => $objBanners->banner_until
                                    , 'banner_comment'      => $objBanners->banner_comment
                                    , 'banner_views_until'  => $objBanners->banner_views_until
                                    , 'banner_clicks_until' => $objBanners->banner_clicks_until
                                    , 'banner_views'        => $objBanners->banner_views
                                    , 'banner_clicks'       => $objBanners->banner_clicks                        
                                     );
            } // while
        }
        
        return $arrBanners;
    }
332589
protected function exec($query)
    {
        if (!$query) {
            throw new Exceptions\RPCException("Empty query.");
        }
        
        $url = sprintf("http://%s:%d", $this->conf["host"], $this->conf["port"]);
        $web = $this->getWebClient();
        $web->setMethod(HttpMethods::POST);
        $web->addHeader("Content-Type", "application/json");
        $web->setBasicAuth($this->conf["user"], $this->conf["pass"]);
        $web->setData($query);
        $response    = $web->request($url);
        $status_code = $response->getCode();
        
        if (isset(self::$exceptions[$status_code])) {
            $error = $this->getResponseError($response, $status_code);
            throw new self::$exceptions[$status_code](
                $error["message"],
                $error["code"]
            );
        }

        return $response;
    }
762966
public function count()
    {
        $request = $this->createRequestInstance(self::CAT_COUNT, null, null);

        return $this->client->send($request);
    }
850525
public function findEnabledAllPostsThatHaveCategoryId($catId)
    {
        $collection = $this->model->find($catId)->post->sortByDesc('updated_at');

        $filtered = $collection->filter(function ($item) {
            if ($item->enabled == 1) return true;
        });

        $filtered = $filtered->filter(function ($item) {
            $todaysDate = DatesHelper::todaysDateSetToLocalTime();
            if ($item->publish_on <= $todaysDate) return true;
        });


        // TODO: HAVE TO MANUALLY PAGINATE THE FILTERED COLLECTION :-(
        // https://laracasts.com/discuss/channels/laravel/laravel-pagination-not-working-with-array-instead-of-collection?page=1#reply-63860
        // http://www.reddit.com/r/laravel/comments/32kxn8/creating_a_paginator_manually/
        return $filtered->all();
    }
1194305
public function join( $relative )
		{
			$uri = new phpUri( $relative );
			switch ( TRUE )
			{
				case !empty( $uri->scheme ):
					break;

				case !empty( $uri->authority ):
					break;

				case empty( $uri->path ):
					$uri->path = $this->path;
					if ( empty( $uri->query ) )
					{
						$uri->query = $this->query;
					}
					break;

				case strpos( $uri->path, '/' ) === 0:
					break;

				default:
					$base_path = $this->path;
					if ( strpos( $base_path, '/' ) === FALSE )
					{
						$base_path = '';
					}
					else
					{
						$base_path = preg_replace( '/\/[^\/]+$/', '/', $base_path );
					}
					if ( empty( $base_path ) && empty( $this->authority ) )
					{
						$base_path = '/';
					}
					$uri->path = $base_path . $uri->path;
			}

			if ( empty( $uri->scheme ) )
			{
				$uri->scheme = $this->scheme;
				if ( empty( $uri->authority ) )
				{
					$uri->authority = $this->authority;
				}
			}

			return $uri->to_str();
		}
975287
public function join($query)
    {
        $clause = '';
        $repository = $query->getRepository();
        $resources = $repository->getResources();
        $links = $resources->getLinks();
        foreach ($links as $link) {
            $type = strtoupper($link->resource->getLinkType());
            switch ($type) {
                case 'STRONG' : $type = 'INNER';break;
                case 'WEAK'   : $type = 'LEFT'; break;
            }
            $query->join($type, $link->resource->getName().' AS '.$this->_store->quoteName($link->resource->getAlias()), array(
                $link->child.'='.$link->parent,
            ));
        }

        $this->_links($query, $query->link);

        if (!empty($query->join)) {
            $joins = array();
            foreach ($query->join as $join) {
                $tmp = '';

                if (!empty($join['type'])) {
                    $tmp .= $join['type'].' ';
                }

                $tmp .= 'JOIN '.$join['resource'];
                $tmp .= ' ON '.implode(' AND ', $join['condition']);

                $joins[] = $tmp;
            }

            $clause = implode(' ', $joins);
        }

        return $clause;
    }
304828
public static function array_cate_merge_father($input,$subname='sub'){
        $idpool=[];
        foreach ($input as $key => $value) {
            if(isset($value['id'])){
                if(array_key_exists($value['id'],$idpool)&&$idpool){
                    if(isset($value[$subname])&&$value[$subname]) {
                        $sub=array_merge($input[$idpool[$value['id']]][$subname],$value[$subname]);
                        unset($input[$key]);
                        $input[$idpool[$value['id']]][$subname]=self::array_cate_merge_father($sub,$subname='sub');
                    }
                }else{
                    $idpool[$value['id']]=$key;
                }
            }
        }
        return $input;
    }
1028762
public function exec() {
		$this->ch = curl_init();
		curl_setopt_array($this->ch, [
			CURLOPT_URL => $this->url,
			CURLOPT_POSTFIELDS => $this->data,
			CURLOPT_CUSTOMREQUEST => $this->requestType,
			CURLOPT_HTTPHEADER => $this->createHeaders(),
			CURLOPT_TIMEOUT_MS => intval($this->timeout * 1000),
			CURLOPT_ENCODING => 'gzip',
			CURLOPT_FAILONERROR => false,
			CURLOPT_HEADER => true,
			CURLOPT_RETURNTRANSFER => true,
		]);
		curl_setopt_array($this->ch, $this->extraOpts);

		if ($this->username && $this->password) {
			curl_setopt($this->ch, CURLOPT_USERPWD, "{$this->username}:{$this->password}");
		}

		if ($this->data !== null)
			curl_setopt($this->ch, CURLOPT_POSTFIELDS, $this->data);

		$this->beforeExec();

		$resultData = curl_exec($this->ch);
		$httpCode = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);

		if (curl_errno($this->ch) !== CURLE_OK) {
			throw new Exception(curl_error($this->ch), curl_errno($this->ch));
		}

		$response = new Response($httpCode, $resultData, curl_getinfo($this->ch, CURLINFO_HEADER_SIZE));

		if  ($httpCode >= 400) {
			throw new Exception("HTTP transfer error {$httpCode}", null, $httpCode, $response);
		}

		curl_close($this->ch);

		return $response;
	}
959304
public static function makeUri($host, $path, $query = '', $port = 80, $scheme = 'http', $fragment = '', $userInfo = '')
    {
        return new static(static::makeUriString($host, $path, $query, $port, $scheme, $fragment, $userInfo));
    }
947647
public static function array_cate_only_top($input,$total,$pidname='pid',$subname='sub'){
        $total=\app\tool\cate::array_cate_as_subarray($total);
        $father_pool=[];
        foreach ($input as $k=>$v){
            $father=self::array_top_father($v['pid'],$total,$pidname,$subname);
            if(array_key_exists($father['id'],$father_pool)){
                $father_pool[$father['id']]['sub'][]=$v;
            }else{
                $father_pool[$father['id']]=$father;
                $father_pool[$father['id']]['sub'][]=$v;
            }
        }
        return $father_pool;
    }
271928
public static function get($key, $default = null)
    {
        static $variables;

        if ($variables === null) {
            $variables = (new DotenvFactory([new EnvConstAdapter, new PutenvAdapter, new ServerConstAdapter]))->createImmutable();
        }

        return Option::fromValue($variables->get($key))
                     ->map(function ($value) {
                         switch (strtolower($value)) {
                             case 'true':
                             case '(true)':
                                 return true;
                             case 'false':
                             case '(false)':
                                 return false;
                             case 'empty':
                             case '(empty)':
                                 return '';
                             case 'null':
                             case '(null)':
                                 return;
                         }

                         if (preg_match('/\A([\'"])(.*)\1\z/', $value, $matches)) {
                             return $matches[2];
                         }

                         return $value;
                     })
                     ->getOrCall(function () use ($default) {
                         return value($default);
                     });
    }
802096
public function cat(): void
    {
        $paths = $this->getConfigPaths();

        foreach ($paths as $path) {
            WP_CLI::line(
                WP_CLI::colorize("%B====> Printing $path%n")
            );

            // phpcs:ignore WordPressVIPMinimum.VIP.FetchingRemoteData.fileGetContentsUknown
            $contents = file_get_contents($path);

            $contentsWithoutLineBreaks = str_replace(["\r", "\n"], '', $contents);
            if (empty($contentsWithoutLineBreaks)) {
                WP_CLI::error_multi_line([
                    "File '$path' is empty.",
                ]);
            }

            WP_CLI::line($contents);
            // Print a empty line for better UX.
            WP_CLI::line('');
        }
    }
962911
public static function array_cate_in_sub($input,$total,$pid=0,$pidname='pid',$subname='sub'){

        $result=self::array_cate_as_subarray_killold($input,$pid,$pidname,$subname);
        $total =self::array_cate_as_subarray($total,$pid,$pidname,$subname);

        if($input){
            $pid_input=[];
            $sub=[];
            foreach($input as $key=>$value){
                if(in_array($value[$pidname], $pid_input)){
                    $sub[$value[$pidname]][]=$value;
                }else{
                    $pid_input[]=$value[$pidname];
                    $sub[$value[$pidname]][]=$value;
                }
            }
            foreach ($sub as $key => $value) {

                $result[]=self::array_all_father($key,$total,$value,$pidname,$subname);
            }
        }
        return self::array_cate_merge_father($result,$subname);
    }
1216188
public static function wrap($source, $fopen = null, $opendir = null, $mkdir = null, $rename = null, $rmdir = null,
								$unlink = null, $stat = null) {
		return new Path(static::class, [
			'source' => $source,
			'fopen' => $fopen,
			'opendir' => $opendir,
			'mkdir' => $mkdir,
			'rename' => $rename,
			'rmdir' => $rmdir,
			'unlink' => $unlink,
			'stat' => $stat
		]);
	}