for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace diecoding\flysystem;
use League\Flysystem\Local\LocalFilesystemAdapter;
use Yii;
use yii\base\InvalidConfigException;
/**
* Class LocalComponent
*
* ```php
* 'components' => [
* 'fs' => [
* 'class' => \diecoding\flysystem\LocalComponent::class,
* 'path' => dirname(dirname(__DIR__)) . '/storage', // or you can use @alias
* 'prefix' => '',
* ],
* ```
* @package diecoding\flysystem
* @link https://sugengsulistiyawan.my.id/
* @author Sugeng Sulistiyawan <[email protected]>
* @copyright Copyright (c) 2023
*/
class LocalComponent extends AbstractComponent
{
* @var string
public $path;
* @inheritdoc
public function init()
if (empty($this->path)) {
throw new InvalidConfigException('The "path" property must be set.');
}
if (empty($this->secret)) {
secret
diecoding\flysystem\LocalComponent
__get
throw new InvalidConfigException('The "secret" property must be set.');
parent::init();
* @return LocalFilesystemAdapter
protected function initAdapter()
$location = $this->normalizePath(Yii::getAlias($this->path) . '/' . $this->prefix);
Yii::getAlias($this->path)
false|string
concatenation
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
$location = $this->normalizePath(/** @scrutinizer ignore-type */ Yii::getAlias($this->path) . '/' . $this->prefix);
return new LocalFilesystemAdapter($location);