for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Install GitHub App
<?php
/**
* Created by PhpStorm.
* User: Marky
* Date: 30/12/2017
* Time: 18:51.
*/
namespace App\Classes\Library\PageLoader;
use App\Model\Menu;
use Illuminate\Support\Collection;
* Class Navigation.
class Navigation
{
* @var array
private $routes = [];
* @var Collection
public $collection = [];
* Navigation constructor.
*
* @param Collection $repository
public function __construct(Collection $repository)
$this->routes = $this->splitRoutes();
$this->collection = $this->generateNav($repository->keyBy('title'));
}
* @return Collection
protected function generateNav(Collection $repository)
$collection = new Collection;
/** @var Menu $item */
foreach ($repository as $item) {
$collection->put($item->title, $parent = $this->makeNavItem($item));
/* @var NavItem $parent */
foreach ($item->children as $new) {
$parent->addChild($this->makeNavItem($new));
$this->makeNavItem($new)
object<App\Classes\Library\PageLoader\NavItem>
object<self>
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
return $this->collection = $collection;
* @return array
private function splitRoutes()
$path = app('request')->path();
if ($path == '/') {
return $this->routes = ['index'];
return explode('/', $path);
* @default $menu->page->slug == currentURI() ? true : false;
* @param string $string
* @return bool
public function isActiveTitle(string $string)
return in_array(str_slug($string), $this->routes);
* @param $menu
* @return NavItem
protected function makeNavItem(Menu $menu): NavItem
return new NavItem($menu, $this->isActiveTitle($menu->page->slug));
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: