Issues (197)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Http/JsonApiBaseController.php (38 issues)

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 declare (strict_types = 1);
2
3
namespace Limoncello\Flute\Http;
4
5
/**
6
 * Copyright 2015-2019 [email protected]
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
21
use Limoncello\Contracts\Data\ModelSchemaInfoInterface;
22
use Limoncello\Contracts\L10n\FormatterFactoryInterface;
23
use Limoncello\Flute\Contracts\Encoder\EncoderInterface;
24
use Limoncello\Flute\Contracts\FactoryInterface;
25
use Limoncello\Flute\Contracts\Http\JsonApiControllerInterface;
26
use Limoncello\Flute\Contracts\Schema\JsonSchemasInterface;
27
use Limoncello\Flute\Http\Traits\DefaultControllerMethodsTrait;
28
use Psr\Container\ContainerExceptionInterface;
29
use Psr\Container\ContainerInterface;
30
use Psr\Container\NotFoundExceptionInterface;
31
use Psr\Http\Message\ResponseInterface;
32
use Psr\Http\Message\ServerRequestInterface;
33
34
/**
35
 * @package Limoncello\Flute
36
 */
37
abstract class JsonApiBaseController implements JsonApiControllerInterface
38
{
39
    use DefaultControllerMethodsTrait;
40
41
    /** @var string|null API class name */
42
    const API_CLASS = null;
43
44
    /** @var string|null JSON API Schema class name */
45
    const SCHEMA_CLASS = null;
46
47
    /** @var string|null @var string|null JSON API query validation rules class */
48
    const ON_INDEX_QUERY_VALIDATION_RULES_CLASS = null;
49
50
    /** @var string|null @var string|null JSON API query validation rules class */
51
    const ON_READ_QUERY_VALIDATION_RULES_CLASS = null;
52
53
    /** @var string|null @var string|null JSON API data validation rules class */
54
    const ON_CREATE_DATA_VALIDATION_RULES_CLASS = null;
55
56
    /** @var string|null JSON API data validation rules class */
57
    const ON_UPDATE_DATA_VALIDATION_RULES_CLASS = null;
58
59
    /**
60
     * @inheritdoc
61
     */
62 12 View Code Duplication
    public static function index(
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
63
        array $routeParams,
64
        ContainerInterface $container,
65
        ServerRequestInterface $request
66
    ): ResponseInterface {
67 12
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
68 12
        static::assertClassValueDefined(static::SCHEMA_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
69 12
        static::assertClassValueDefined(static::ON_INDEX_QUERY_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
70
71 12
        return static::defaultIndexHandler(
72 12
            $request->getQueryParams(),
73 12
            $request->getUri(),
74 12
            static::defaultCreateQueryParser($container, static::ON_INDEX_QUERY_VALIDATION_RULES_CLASS),
75 12
            static::defaultCreateParameterMapper($container, static::SCHEMA_CLASS),
76 12
            static::defaultCreateApi($container, static::API_CLASS),
77 12
            $container->get(EncoderInterface::class)
78
        );
79
    }
80
81
    /**
82
     * @inheritdoc
83
     */
84 2 View Code Duplication
    public static function create(
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
85
        array $routeParams,
86
        ContainerInterface $container,
87
        ServerRequestInterface $request
88
    ): ResponseInterface {
89 2
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
90 2
        static::assertClassValueDefined(static::SCHEMA_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
91 2
        static::assertClassValueDefined(static::ON_CREATE_DATA_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
92
93 2
        $response = static::defaultCreateHandler(
94 2
            $request->getUri(),
95 2
            (string)$request->getBody(),
96 2
            static::SCHEMA_CLASS,
97 2
            $container->get(ModelSchemaInfoInterface::class),
98 2
            static::defaultCreateDataParser($container, static::ON_CREATE_DATA_VALIDATION_RULES_CLASS),
99 2
            static::defaultCreateApi($container, static::API_CLASS),
100 2
            $container->get(JsonSchemasInterface::class),
101 2
            $container->get(EncoderInterface::class),
102 2
            $container->get(FactoryInterface::class),
103 2
            $container->get(FormatterFactoryInterface::class)
104
        );
105
106 1
        return $response;
107
    }
108
109
    /**
110
     * @inheritdoc
111
     */
112 1 View Code Duplication
    public static function read(
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
113
        array $routeParams,
114
        ContainerInterface $container,
115
        ServerRequestInterface $request
116
    ): ResponseInterface {
117 1
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
118 1
        static::assertClassValueDefined(static::SCHEMA_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
119 1
        static::assertClassValueDefined(static::ON_READ_QUERY_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
120
121 1
        return static::defaultReadHandler(
122 1
            (string)$routeParams[static::ROUTE_KEY_INDEX],
123 1
            $request->getQueryParams(),
124 1
            $request->getUri(),
125 1
            static::defaultCreateQueryParser($container, static::ON_READ_QUERY_VALIDATION_RULES_CLASS),
126 1
            static::defaultCreateParameterMapper($container, static::SCHEMA_CLASS),
127 1
            static::defaultCreateApi($container, static::API_CLASS),
128 1
            $container->get(EncoderInterface::class)
129
        );
130
    }
131
132
    /**
133
     * @inheritdoc
134
     */
135 6 View Code Duplication
    public static function update(
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
136
        array $routeParams,
137
        ContainerInterface $container,
138
        ServerRequestInterface $request
139
    ): ResponseInterface {
140 6
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
141 6
        static::assertClassValueDefined(static::SCHEMA_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
142 6
        static::assertClassValueDefined(static::ON_UPDATE_DATA_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
143
144 6
        $response = static::defaultUpdateHandler(
145 6
            (string)$routeParams[static::ROUTE_KEY_INDEX],
146 6
            $request->getUri(),
147 6
            (string)$request->getBody(),
148 6
            static::SCHEMA_CLASS,
149 6
            $container->get(ModelSchemaInfoInterface::class),
150 6
            static::defaultCreateDataParser($container, static::ON_UPDATE_DATA_VALIDATION_RULES_CLASS),
151 6
            static::defaultCreateApi($container, static::API_CLASS),
152 6
            $container->get(EncoderInterface::class),
153 6
            $container->get(FactoryInterface::class),
154 6
            $container->get(FormatterFactoryInterface::class)
155
        );
156
157 2
        return $response;
158
    }
159
160
    /**
161
     * @inheritdoc
162
     */
163 1
    public static function delete(
164
        array $routeParams,
165
        ContainerInterface $container,
166
        ServerRequestInterface $request
167
    ): ResponseInterface {
168 1
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
169
170 1
        $response = static::defaultDeleteHandler(
171 1
            (string)$routeParams[static::ROUTE_KEY_INDEX],
172 1
            $request->getUri(),
173 1
            static::defaultCreateQueryParser($container, static::ON_READ_QUERY_VALIDATION_RULES_CLASS),
174 1
            static::defaultCreateApi($container, static::API_CLASS),
175 1
            $container->get(EncoderInterface::class)
176
        );
177
178 1
        return $response;
179
    }
180
181
    /**
182
     * @param string                 $index
183
     * @param string                 $modelRelName
184
     * @param string                 $queryValRulesClass
185
     * @param ContainerInterface     $container
186
     * @param ServerRequestInterface $request
187
     *
188
     * @return ResponseInterface
189
     *
190
     * @throws ContainerExceptionInterface
191
     * @throws NotFoundExceptionInterface
192
     */
193 2 View Code Duplication
    protected static function readRelationship(
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
194
        string $index,
195
        string $modelRelName,
196
        string $queryValRulesClass,
197
        ContainerInterface $container,
198
        ServerRequestInterface $request
199
    ): ResponseInterface {
200 2
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
201 2
        static::assertClassValueDefined(static::SCHEMA_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
202
203 2
        $api     = static::defaultCreateApi($container, static::API_CLASS);
204
        $handler = function () use ($api, $index, $modelRelName) {
205 2
            return $api->readRelationship($index, $modelRelName);
206 2
        };
207
208 2
        return static::defaultReadRelationshipWithClosureHandler(
209 2
            $index,
210 2
            $handler,
211 2
            $request->getQueryParams(),
212 2
            $request->getUri(),
213 2
            static::defaultCreateQueryParser($container, $queryValRulesClass),
214 2
            static::defaultCreateParameterMapper($container, static::SCHEMA_CLASS),
215 2
            $api,
216 2
            $container->get(EncoderInterface::class)
217
        );
218
    }
219
220
    /**
221
     * @param string                 $index
222
     * @param string                 $modelRelName
223
     * @param string                 $queryValRulesClass
224
     * @param ContainerInterface     $container
225
     * @param ServerRequestInterface $request
226
     *
227
     * @return ResponseInterface
228
     *
229
     * @throws ContainerExceptionInterface
230
     * @throws NotFoundExceptionInterface
231
     */
232 1 View Code Duplication
    protected static function readRelationshipIdentifiers(
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
233
        string $index,
234
        string $modelRelName,
235
        string $queryValRulesClass,
236
        ContainerInterface $container,
237
        ServerRequestInterface $request
238
    ): ResponseInterface {
239 1
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
240 1
        static::assertClassValueDefined(static::SCHEMA_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
241
242 1
        $api     = static::defaultCreateApi($container, static::API_CLASS);
243
        $handler = function () use ($api, $index, $modelRelName) {
244 1
            return $api->readRelationship($index, $modelRelName);
245 1
        };
246
247 1
        return static::defaultReadRelationshipIdentifiersWithClosureHandler(
248 1
            $index,
249 1
            $handler,
250 1
            $request->getQueryParams(),
251 1
            $request->getUri(),
252 1
            static::defaultCreateQueryParser($container, $queryValRulesClass),
253 1
            static::defaultCreateParameterMapper($container, static::SCHEMA_CLASS),
254 1
            $api,
255 1
            $container->get(EncoderInterface::class)
256
        );
257
    }
258
259
    /**
260
     * @param string                 $parentIndex
261
     * @param string                 $jsonRelName
262
     * @param string                 $modelRelName
263
     * @param ContainerInterface     $container
264
     * @param ServerRequestInterface $request
265
     *
266
     * @return ResponseInterface
267
     */
268 2 View Code Duplication
    protected static function addInRelationship(
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
269
        string $parentIndex,
270
        string $jsonRelName,
271
        string $modelRelName,
272
        ContainerInterface $container,
273
        ServerRequestInterface $request
274
    ): ResponseInterface {
275 2
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
276 2
        static::assertClassValueDefined(static::SCHEMA_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
277 2
        static::assertClassValueDefined(static::ON_READ_QUERY_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
278 2
        static::assertClassValueDefined(static::ON_UPDATE_DATA_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
279
280 2
        return static::defaultAddInRelationshipHandler(
281 2
            $parentIndex,
282 2
            $jsonRelName,
283 2
            $modelRelName,
284 2
            $request->getUri(),
285 2
            $request->getBody(),
286 2
            static::SCHEMA_CLASS,
287 2
            $container->get(ModelSchemaInfoInterface::class),
288 2
            static::defaultCreateQueryParser($container, static::ON_READ_QUERY_VALIDATION_RULES_CLASS),
289 2
            static::defaultCreateDataParser($container, static::ON_UPDATE_DATA_VALIDATION_RULES_CLASS),
290 2
            static::defaultCreateApi($container, static::API_CLASS),
291 2
            $container->get(EncoderInterface::class),
292 2
            $container->get(FactoryInterface::class),
293 2
            $container->get(FormatterFactoryInterface::class)
294
        );
295
    }
296
297
    /**
298
     * @param string                 $parentIndex
299
     * @param string                 $jsonRelName
300
     * @param string                 $modelRelName
301
     * @param ContainerInterface     $container
302
     * @param ServerRequestInterface $request
303
     *
304
     * @return ResponseInterface
305
     */
306 1 View Code Duplication
    protected static function deleteInRelationship(
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
307
        string $parentIndex,
308
        string $jsonRelName,
309
        string $modelRelName,
310
        ContainerInterface $container,
311
        ServerRequestInterface $request
312
    ): ResponseInterface {
313 1
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
314 1
        static::assertClassValueDefined(static::SCHEMA_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
315 1
        static::assertClassValueDefined(static::ON_READ_QUERY_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
316 1
        static::assertClassValueDefined(static::ON_UPDATE_DATA_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
317
318 1
        return static::defaultDeleteInRelationshipHandler(
319 1
            $parentIndex,
320 1
            $jsonRelName,
321 1
            $modelRelName,
322 1
            $request->getUri(),
323 1
            $request->getBody(),
324 1
            static::SCHEMA_CLASS,
325 1
            $container->get(ModelSchemaInfoInterface::class),
326 1
            static::defaultCreateQueryParser($container, static::ON_READ_QUERY_VALIDATION_RULES_CLASS),
327 1
            static::defaultCreateDataParser($container, static::ON_UPDATE_DATA_VALIDATION_RULES_CLASS),
328 1
            static::defaultCreateApi($container, static::API_CLASS),
329 1
            $container->get(EncoderInterface::class),
330 1
            $container->get(FactoryInterface::class),
331 1
            $container->get(FormatterFactoryInterface::class)
332
        );
333
    }
334
335
    /**
336
     * @param string                 $parentIndex
337
     * @param string                 $jsonRelName
338
     * @param string                 $modelRelName
339
     * @param ContainerInterface     $container
340
     * @param ServerRequestInterface $request
341
     *
342
     * @return ResponseInterface
343
     */
344 2 View Code Duplication
    protected static function replaceInRelationship(
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
345
        string $parentIndex,
346
        string $jsonRelName,
347
        string $modelRelName,
348
        ContainerInterface $container,
349
        ServerRequestInterface $request
350
    ): ResponseInterface {
351 2
        static::assertClassValueDefined(static::API_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
352 2
        static::assertClassValueDefined(static::SCHEMA_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
353 2
        static::assertClassValueDefined(static::ON_READ_QUERY_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
354 2
        static::assertClassValueDefined(static::ON_UPDATE_DATA_VALIDATION_RULES_CLASS);
0 ignored issues
show
Since assertClassValueDefined() is declared private, calling it with static will lead to errors in possible sub-classes. You can either use self, or increase the visibility of assertClassValueDefined() to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
}

public static function getSomeVariable()
{
    return static::getTemperature();
}

}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass {
      private static function getTemperature() {
        return "-182 °C";
    }
}

print YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class YourClass
{
    private static function getTemperature() {
        return "3422 °C";
    }

    public static function getSomeVariable()
    {
        return self::getTemperature();
    }
}
Loading history...
355
356 2
        return static::defaultReplaceInRelationship(
357 2
            $parentIndex,
358 2
            $jsonRelName,
359 2
            $modelRelName,
360 2
            $request->getUri(),
361 2
            $request->getBody(),
362 2
            static::SCHEMA_CLASS,
363 2
            $container->get(ModelSchemaInfoInterface::class),
364 2
            static::defaultCreateQueryParser($container, static::ON_READ_QUERY_VALIDATION_RULES_CLASS),
365 2
            static::defaultCreateDataParser($container, static::ON_UPDATE_DATA_VALIDATION_RULES_CLASS),
366 2
            static::defaultCreateApi($container, static::API_CLASS),
367 2
            $container->get(EncoderInterface::class),
368 2
            $container->get(FactoryInterface::class),
369 2
            $container->get(FormatterFactoryInterface::class)
370
        );
371
    }
372
}
373