Completed
Push — master ( 1ed12b...1ef741 )
by Nicolas
07:28
created

Repositories/Cache/CacheTagDecorator.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Modules\Tag\Repositories\Cache;
4
5
use Modules\Core\Repositories\Cache\BaseCacheDecorator;
6
use Modules\Tag\Repositories\TagRepository;
7
8
class CacheTagDecorator extends BaseCacheDecorator implements TagRepository
9
{
10
    public function __construct(TagRepository $tag)
11
    {
12
        parent::__construct();
13
        $this->entityName = 'tag.tags';
14
        $this->repository = $tag;
15
    }
16
17
    /**
18
     * Get all the tags in the given namespace
19
     * @param string $namespace
20
     * @return \Illuminate\Database\Eloquent\Collection
21
     */
22
    public function allForNamespace($namespace)
23
    {
24
        return $this->cache
25
            ->tags($this->entityName, 'global')
0 ignored issues
show
The call to Repository::tags() has too many arguments starting with 'global'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
26
            ->remember("{$this->locale}.{$this->entityName}.allForNamespace.{$namespace}", $this->cacheTime,
27
                function () use ($namespace) {
28
                    return $this->repository->allForNamespace($namespace);
29
                }
30
            );
31
    }
32
}
33