@param string      $path
@param int         $type
@param string|null $description

@return Detection
430971
protected function createDetection(string $path, $type = Detection::TYPE_VIRUS, $description = null): Detection
    {
        return new Detection($path, $type, $description);
    }
79607
public static function copy(string $path, string $to, string $type, bool $symlink = false):int
    {
        try {
            if ($symlink != false) {
                @symlink($path, $to);
            } elseif ($symlink == false && $type == "directory") {
                self::recursiveCopy($path, $to);
            } elseif ($symlink == false && $type == "file") {
                copy($path, $to);
            } else {
                throw new \Exception("Server Error on Copy: Element type is not regonized");
            }
        } catch (\Exception $exception) {
            throw new \Exception("Server Error : Cannot move $path to $to => ".$exception);
        }

        return (1);
    }
1034452
protected function path($path, $type)
    {
        if (Configure::read('debug') && !Configure::read('Assets.force')) {
            return $path;
        }

        $asset = new AssetsCreator($path, $type);
        $path = '/assets/' . $asset->create();

        //Appends the timestamp
        $stamp = Configure::read('Asset.timestamp');
        if ($stamp === 'force' || ($stamp === true && Configure::read('debug'))) {
            $path = sprintf('%s.%s?%s', $path, $type, filemtime($asset->path()));
        }

        return $path;
    }
293237
protected function _arrayInclude($path, array $options = [], $type = 'css')
    {
        $doc = $this->Document;
        if (is_array($path)) {
            $out = '';
            foreach ($path as $i) {
                $out .= $this->{$type}($i, $options);
            }

            if (empty($options['block'])) {
                return $out . $doc->eol;
            }

            return null;
        }

        return false;
    }
1311464
protected function info( $path, $base, $full, $type, $recursive = true )
    {
        $name = basename( $path );

        if ( isset( $name[0] ) && $name[0] == '.' )
        {
            return null;
        }

        $result = (object) array(
            'name' => $name,
            'path' => $path,
            'uri'  => '/' . $base,
            'type' => $type,
            'size' => filesize( $full ),
            'time' => filemtime( $full ),
        );

        $result->rights = $this->rights( $path );

        if ( ! $result->rights->read )
        {
            return null;
        }

        switch ( $type )
        {
            case 'dir':

                if ( $recursive )
                {
                    $result->entries = array();

                    $iterator = new FilesystemIterator( $full,
                        FilesystemIterator::KEY_AS_FILENAME     |
                        FilesystemIterator::CURRENT_AS_FILEINFO |
                        FilesystemIterator::SKIP_DOTS
                    );

                    $iterator = new SortIterator(
                        $iterator,
                        function ( $a, $b )
                        {
                            $aIsDir = $a->isDir();
                            $bIsDir = $b->isDir();
                            $aFname = $a->getFilename();
                            $bFname = $b->getFilename();

                            switch ( true )
                            {
                                case ! $aIsDir && $bIsDir:
                                    return 1;

                                case $aIsDir && ! $bIsDir:
                                    return -1;

                                default:
                                    return strnatcasecmp( $aFname, $bFname );
                            }
                        }
                    );

                    foreach ( $iterator as $name => $info )
                    {
                        $child = null;

                        if ( $name[0] != '.' )
                        {
                            if ( $info->isDir() )
                            {
                                $child = $this->info(
                                    ( empty( $path ) ? ''
                                        : $path . '/' ) . $name,
                                    $base . '/' . $name,
                                    $full . '/' . $name,
                                    'dir', false
                                );
                            }
                            else if ( $info->isFile() )
                            {
                                $child = $this->info(
                                    ( empty( $path ) ? ''
                                        : $path . '/' ) . $name,
                                    $base . '/' . $name,
                                    $full . '/' . $name,
                                    'file', false
                                );
                            }
                        }

                        if ( null !== $child )
                        {
                            $result->entries[] = $child;
                        }
                    }
                }

                break;

            case 'file':

                $result->mime = $this->mime( $full );

                break;
        }

        return $result;
    }
1022615
public function importResource($type, $path) {
        $src = '/static/'.$path;
        $template = self::$resTemplate[$type];
        $result = str_replace('{url}', $src, $template);
        return $result;
	}
1307182
public function set($type, $path)
    {
        if ($path instanceof pathmanager\FallbackInterface) {
            $this->paths[$type] = $path;
            return $this;
        }

        if (is_array($path)) {
            if (isset($this->paths[$type])) {
                $fallback = $this->paths[$type];
                if (!$fallback instanceof pathmanager\FallbackInterface) {
                    $first = $fallback;
                    $fallback = new pathmanager\DefaultFallback();
                    $fallback->addPath($first);
                }
            } else {
                $fallback = new pathmanager\DefaultFallback();
            }

            $this->paths[$type] = $fallback;
            foreach ($path as $item) {
                $this->set($type, $item);
            }

            return $this;
        }

        $path = $this->prepare($path);

        if (isset($this->paths[$type]) && ($this->paths[$type] instanceof pathmanager\FallbackInterface)) {
            $this->paths[$type]->addPath($path);
        } else {
            $this->paths[$type] = $path;
        }

        return $this;
    }
951001
private function assertExists($type)
    {
        if (!isset($this->typePaths[$type])) {
            throw new Exception\DocumentTypeNotFoundException(
                sprintf(
                    'Structure path for document type "%s" is not mapped. Mapped structure types: "%s"',
                    $type,
                    implode('", "', array_keys($this->typePaths))
                )
            );
        }
    }
409481
public function sslCert($path, $type = null, $password = null)
    {
        $this->certPath = $path;
        if(null !== $type)
        {
            $this->certType = $type;
        }
        if(null !== $password)
        {
            $this->certPassword = $password;
        }
        return $this;
    }
1264239
public function SaveDefinitions(
        $path = null, 
        $type=\Peg\Lib\Definitions\Type::JSON
    )
    {
        $this->exporter->definitions_path = $path;
        $this->exporter->export_type = $type;
        
        $this->exporter->Start();
    }
830062
public function file($path, $type = 'debug')
    {
        $this->pushHandler(new StreamHandler($path, $this->getLevel($type)));
    }
748061
public function createReturnTag($type, $description = null)
    {
        return $this->internalCreateTag(true, 'return', $this->classFile->getType($type), $description);
    }
451435
public function addIncludePath($path, $type = 'prepend') {
    if (!$this->hasIncludePath($path)) {
      if ($type == 'append') {
        $ret = set_include_path(rtrim(get_include_path(),PATH_SEPARATOR).PATH_SEPARATOR.$path);
      } else {
        $ret = set_include_path($path.PATH_SEPARATOR.ltrim(get_include_path(),PATH_SEPARATOR));
      }
      if ($ret === FALSE) {
        throw new \Psc\Exception('cannot set include path!. Vielleicht ist php_admin_value (statt php_value) auf include_path inder apache.conf gesetzt?');
      }
    }
    return $this;
  }
892502
public function installExtensionFromFolder($path, $type = 'Extension')
	{
		$this->amOnPage('/administrator/index.php?option=com_installer');
		$this->waitForText('Extensions: Install', '30', array('css' => 'H1'));
		$this->click(array('link' => 'Install from Folder'));
		$this->debug('I enter the Path');
		$this->fillField(array('id' => 'install_directory'), $path);
		$this->click(array('id' => 'installbutton_directory'));
		$this->waitForText('was successful', TIMEOUT, array('id' => 'system-message-container'));
		$this->debug("$type successfully installed from $path");
	}
665401
public function add_path($path, $type = null)
	{
		is_null($type) and $type = $this->_path_folders;
		empty($path) and $path = DOCROOT;

		if( is_array($type))
		{
			foreach ($type as $key => $folder)
			{
				is_numeric($key) and $key = $folder;
				$folder = $this->_unify_path($path).ltrim($this->_unify_path($folder),DS);
				array_unshift($this->_asset_paths[$key], $folder);
			}
		}
		else
		{
			// create the asset type if it doesn't exist
			if ( ! isset($this->_asset_paths[$type]))
			{
				$this->_asset_paths[$type] = array();
				$this->_path_folders[$type] = $type.'/';
			}

			$path = $this->_unify_path($path);
			array_unshift($this->_asset_paths[$type], $path);
		}
		return $this;
	}
145826
private function detectFromPath(string $path)
    {
        if (!$this->usePath) {
            return null;
        }

        $dirs = explode('/', ltrim($path, '/'), 2);
        $first = strtolower((string) array_shift($dirs));

        if (!empty($first) && in_array($first, $this->languages, true)) {
            return $first;
        }
    }
495154
protected function is($path, $type)
    {
        if (! $this->adapter->isAbsolute($path)) {
            $path = $this->rootPath . $path;
        }
        switch ($type) {
            case 'readable':
                return $this->adapter->isReadable($path);
            case 'writable':
                return $this->adapter->isWritable($path);
            case 'executable':
                return $this->adapter->isExecutable($path);
            case 'file':
                return $this->adapter->isFile($path);
            case 'dir':
                return $this->adapter->isDir($path);
            case 'any':
                return $this->adapter->fileExists($path);
            default:
                throw new FilesystemException("Unknown file type '{$type}'");
        }
    }