Reset assets
@param string $filePath register a single css file to assets manager
@return AssetsServiceProvider this is useful to make a method-chaining
323291
public function registerCss($filePath="",$package_name='')
	{
		if(!empty($filePath))
		{
			if(!empty($package_name))
				$package_name .= ':';
			$this->css[$package_name.basename($filePath)] = $filePath;
		}
		return $this;
	}
1357150
public function setAvatar($filepath)
    {
        if (! file_exists($filepath)) {
            throw new FileNotFoundException("File does not exist at path {$filepath}.");
        }

        $extension = pathinfo($filepath, PATHINFO_EXTENSION);
        $file      = file_get_contents($filepath);
        $base64    = base64_encode($file);

        $this->attributes['avatarhash'] = "data:image/{$extension};base64,{$base64}";

        return true;
    }
33256
public static function create(string $filePath): UnreadableVersionFileException
    {
        $template = 'File %s, who contains version of the application, is not readable. Does the file exist?';
        $message = sprintf($template, $filePath);

        return new static($message);
    }
1042955
public function delete($filePath)
    {
        $relativePath = $this->fs->makePathRelative($filePath, $this->root);
        if (preg_match('!(^|/)\.\.!', $relativePath)) {
            throw new \RuntimeException("{$relativePath} does not seem to be managed by the filemanager");
        }
        if ($this->fs->exists($filePath)) {
            $this->fs->remove($filePath);
            $this->dispatchEvent(ResourceEvent::DELETED, $filePath);
            return true;
        }
        return false;
    }
178954
protected function setFilePath($filePath)
	{
		if ( ! is_string($filePath))
		{
			throw new \InvalidArgumentException('File path must be a string type.');
		}
		
		if (preg_match('~^(\w+:)?//~', $filePath) || is_link($filePath))
		{
			throw new \InvalidArgumentException('File path must be a local path.');
		}
		
		$filePath = realpath($filePath);
		
		if ( ! is_file($filePath))
		{
			throw new TranscoderException('File path not found.');
		}
		
		$this->filePath = $filePath;
		
		return $this;
	}
1001597
protected function restoreFile($filePath, $backupPath, $clean = true)
    {
        if (file_exists($backupPath)) {
            copy($backupPath, $filePath);

            if ($clean) {
                unlink($backupPath);
            }
        }

        return $backupPath;
    }
429196
public function setFilePath($filePath)
    {
        Assert::stringNotEmpty($filePath, 'The factory file path must be a non-empty string. Got: %s');

        $this->setDirectory(Path::getDirectory($filePath));
        $this->setFileName(Path::getFilename($filePath));

        return $this;
    }
244976
public function setFile($filePath = '.gitignore')
    {
        $this->fileContent = array();
        $this->afterLine = null;
        $this->filePath = $filePath;
        $this->checkPermissions();
        $this->parse();
    }
291034
public function resetPath($path = '')
    {
        $this->blob = (new Blob($this->package))->setPath($path);

        // Ensure that user folder exists on first load
        $userFolder = Str::normalizePath(config('cripfilesys.user_folder'));
        if ($this->blob->path == $userFolder) {
            $this->makeDirectory();
        }
    }
825614
private function deleteCacheSubfoldersIfEmpty($filepath)
    {
        if ($this->cache_path == $filepath) {
            // Do not delete main cache folder itself.
            return true;
        }

        $filepath_exp = explode(DIRECTORY_SEPARATOR, $filepath);
        if (is_array($filepath_exp)) {
            for ($i = count($filepath_exp)-1; $i >= 0 ; $i--) {
                $dir = implode(DIRECTORY_SEPARATOR, $filepath_exp);
                $iterator = new \FilesystemIterator($dir);
                $isDirEmpty = !$iterator->valid();
                unset($iterator);

                if ($this->cache_path == $dir) {
                    // Do not delete main cache folder.
                    return true;
                } elseif (is_dir($dir) && !is_writable($dir)) {
                    // Directory is unable to delete.
                    return false;
                } elseif (is_dir($dir) && $isDirEmpty !== true) {
                    // Directory is not empty.
                    return true;
                } elseif (is_dir($dir) && $isDirEmpty === true && is_writable($dir) && $this->cache_path != $dir) {
                    rmdir($dir);
                    unset($filepath_exp[$i]);
                } else {
                    return true;
                }
            }
            unset($i);
        }
        unset($filepath_exp);

        return true;
    }
1079942
public function fix($filePath, array $rules)
    {
        if (empty($rules)) {
            return null;
        }

        if (defined('HHVM_VERSION_ID')) // @codeCoverageIgnoreStart
        {
            throw new Exception("HHVM not supported");
        } // @codeCoverageIgnoreEnd

        elseif (! defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50600) // @codeCoverageIgnoreStart
        {
            throw new Exception("PHP needs to be a minimum version of PHP 5.6.0");
        }
        // @codeCoverageIgnoreEnd

        if (! file_exists($filePath)) {
            throw new Exception('File "'.$filePath.'" does not exist, cannot fix it');
        }

        $options = [
            '--allow-risky'    => 'yes',
            '--format'         => 'txt',
            '--show-progress'  => 'none',
            '--using-cache'    => 'no',
            '--rules'          => json_encode($rules),
            '--no-interaction' => true,
            'command'          => 'fix',
            'path'             => [$filePath],
        ];

        $input  = new ArrayInput($options);
        $output = new BufferedOutput();
        $app    = new Application();
        $app->doRun($input, $output);

        return $output->fetch();
    }
1230296
public function restore($filepath)
	{
		if (!$this->getEnabled()) {
			return false;
		}

		if (!$this->getBackupFilesystemInstance()->checkFileExists($filepath)) {
			throw new BackupRestoreException('Unable to restore file "' . $filepath . '" as it doesn\'t exist.');
		}

		$this->setWorkingFilepath($filepath);

		if ($this->getBackupFilesystemInstance()->checkFileEmpty($filepath)) {
			$this->getBackupFilesystemInstance()->removeFile($filepath);

			return false;
		}

		if ($this->isCompressed($filepath)) {
			$filepath = $this->decompressFile($filepath);
		}

		$result = $this->getBackupEngineInstance()->restore($filepath);

		$this->removeTemporaryFiles($this->getWorkingFilepath());

		return $result;
	}
830513
protected function resolveByPath($filePath)
    {
        $this->data['filename']  = $this->makeFileName($filePath);
        $this->data['namespace'] = $this->getNamespace($filePath);

        $this->data['path'] = $this->getBaseNamespace();

        $this->data['className'] = basename($filePath);

        //
        $this->data['fullEvent'] = $option = $this->option('event');

        $this->data['event'] = class_basename($option);
    }
1115557
public static function createFromFilePath ($filePath)
    {
        if (!is_file($filePath))
        {
            throw new \InvalidArgumentException("File does not exist");
        }
        else if (!is_readable($filePath))
        {
            throw new \InvalidArgumentException("File to download is not readable.");
        }

        return new FileDownload(fopen($filePath, "rb"));
    }
227057
public function addAttachment($filePath) {
        if (!$file = fopen($filePath, 'r')) {
            throw new Exception('Cannot open file "' . $filePath . '"');
        }

        $this->attachments[$filePath] = chunk_split(base64_encode(fread($file, filesize($filePath))));
        return $this;
    }
1314126
public function remove($filePaths)
	{
		foreach ($filePaths as $filePath) {
			$directory = dirname($filePath);
			$this->emptyDirectory($directory, true);
		}
	}
802504
public function registerBindings(string $filePath = null)
    {
        is_file($filePath) || $filePath = App::getBasePath() . $filePath;

        if (is_file($filePath)) {
            /** @noinspection PhpIncludeInspection */
            $bindings = require_once $filePath;

            $bindings = is_array($bindings) ? $bindings : [];

            IOC::addBindings($bindings);

            Event::dispatch('minimal.loaded.bindings', [$filePath, $bindings]);
        }
    }