Passed
Push — master ( 9943c9...975968 )
by Vitor de
03:37
created

src/DTOMarketplace/Context/Base.php (1 issue)

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 GFG\DTOMarketplace\Context;
4
5
use GFG\DTOUrl\Url;
6
use GFG\DTOContext\Context\Base as BaseContext;
7
8
abstract class Base extends BaseContext
9
{
10
    /**
11
     * @var Url\Url
12
     */
13
    protected $url;
14
15
    /**
16
     * {@inheritdoc}
17
     */
18 1
    public function getUrl()
19
    {
20 1
        if (!$this->url) {
21 1
            $this->url = new Url($this->getUrlParts());
0 ignored issues
show
Documentation Bug introduced by
It seems like new \GFG\DTOUrl\Url($this->getUrlParts()) of type object<GFG\DTOUrl\Url> is incompatible with the declared type object<GFG\DTOUrl\Url\Url> of property $url.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
22 1
        }
23
24 1
        return $this->url;
25
    }
26
27
    /**
28
     * Extracts the url information from the current class name and
29
     * namespace
30
     *
31
     * @return array
32
     */
33 1
    protected function getUrlParts()
34
    {
35 1
        $path = array_map(
36 1
            'strtolower',
37 1
            array_slice(preg_split('@\\\\|_@', static::class), -3)
38 1
        );
39
40 1
        return ['httpMethod' => $this->getHttpMethod(), 'path' => $path];
41
    }
42
43
    /**
44
     * Get the http method specific for the context
45
     *
46
     * @return string
47
     */
48
    abstract public function getHttpMethod();
49
}
50