micheledamo /
laravel-web-artisan
| 1 | <?php |
||
| 2 | namespace Micheledamo\LaravelWebArtisan; |
||
| 3 | |||
| 4 | use GuzzleHttp; |
||
|
0 ignored issues
–
show
|
|||
| 5 | use Illuminate\Http\Response; |
||
| 6 | |||
| 7 | class LaravelWebArtisan |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The Laravel application instance. |
||
| 11 | * |
||
| 12 | * @var \Illuminate\Foundation\Application |
||
| 13 | */ |
||
| 14 | protected $app; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * True when enabled. |
||
| 18 | * |
||
| 19 | * @var bool |
||
| 20 | */ |
||
| 21 | protected $enabled; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * True when use authentication |
||
| 25 | * |
||
| 26 | * @var |
||
| 27 | */ |
||
| 28 | protected $use_authentication; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * True when authenticated. |
||
| 32 | * |
||
| 33 | * @var |
||
| 34 | */ |
||
| 35 | protected $authenticated; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * LaravelWebArtisan constructor. |
||
| 39 | * |
||
| 40 | * @param null $app |
||
|
0 ignored issues
–
show
|
|||
| 41 | */ |
||
| 42 | public function __construct($app = null) |
||
| 43 | { |
||
| 44 | if (!$app) { |
||
|
0 ignored issues
–
show
|
|||
| 45 | $app = app(); //Fallback when $app is not given |
||
| 46 | } |
||
| 47 | $this->app = $app; |
||
| 48 | |||
| 49 | $this->enabled = value($this->app['config']->get('webartisan.enabled')); |
||
| 50 | $this->use_authentication = value($this->app['config']->get('webartisan.use_authentication')); |
||
| 51 | $this->authenticated = false; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Check if the Web Artisan is enabled |
||
| 56 | * |
||
| 57 | * @return boolean |
||
| 58 | */ |
||
| 59 | public function isEnabled() |
||
| 60 | { |
||
| 61 | return $this->enabled; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Check if the Web Artisan is authenticated |
||
| 66 | * |
||
| 67 | * @return bool |
||
| 68 | */ |
||
| 69 | public function isAuthenticated() |
||
| 70 | { |
||
| 71 | return $this->authenticated or request()->session()->has('webartisan__authenticated'); |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Check if the Web Artisan use authentication before run commands |
||
| 76 | * |
||
| 77 | * @return mixed |
||
| 78 | */ |
||
| 79 | public function useAuthentication() |
||
| 80 | { |
||
| 81 | return $this->use_authentication; |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Render the Web Artisan Window |
||
| 86 | * |
||
| 87 | * @param Response $response |
||
| 88 | */ |
||
| 89 | public function render(Response $response) |
||
| 90 | { |
||
| 91 | $content = $response->getContent(); |
||
| 92 | if (($body = mb_strpos($content, '</body>')) !== false) { |
||
| 93 | $response->setContent(mb_substr($content, 0, $body) . |
||
| 94 | view('webartisan::window', ['webartisan' => $this]) . |
||
| 95 | mb_substr($content, $body)); |
||
| 96 | } |
||
| 97 | } |
||
| 98 | |||
| 99 | /** |
||
| 100 | * Set authenticated |
||
| 101 | * |
||
| 102 | * @param bool $value |
||
| 103 | */ |
||
| 104 | public function setAuthenticated($value = true) |
||
| 105 | { |
||
| 106 | $this->authenticated = $value; |
||
| 107 | } |
||
| 108 | |||
| 109 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths