for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\ViewComposers;
use App\Repositories\PagesRepository;
use Illuminate\Contracts\View\View;
class PagesComposer extends Composer
{
/**
* @var PagesRepository
*/
protected $pages;
* PagesComposer constructor.
* @param PagesRepository $pagesRepository
public function __construct(PagesRepository $pagesRepository)
$this->pages = $pagesRepository;
}
* @param View $view
* @return $this
public function compose(View $view)
switch ($view->getName())
case "partials.header.index":
return $view->with('pages', $this->pages->getHeader());
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
case "partials.footer.navigation_sidebar":
return $view->with('pages', $this->pages->getFooter());
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.