Showing 16 of 52 total issues
File NativeApi.php
has 674 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/**
* TERYT-API
NativeApi
has 56 functions (exceeds 20 allowed). Consider refactoring. Open
final class NativeApi
{
/**
* @var string Wyszukiwanie wśród wszystkich rodzajów jednostek
*/
Function find
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function find(string $id)
{
switch (strlen($id)) {
case 6:
$provinceId = substr($id, 0, 2);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method find
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function find(string $id)
{
switch (strlen($id)) {
case 6:
$provinceId = substr($id, 0, 2);
Function searchDistricts
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function searchDistricts(string $phrase = null)
{
try {
$answer = [];
if ($phrase) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method WeryfikujNazwaAdresUlic
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $provinceName,
string $districtName,
string $communeName,
string $cityName,
string $cityTypeName = null,
Function getKeyValues
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getKeyValues(array $tItems, string $sKey, bool $asUnique = true): array
{
$answer = [];
foreach ($tItems as $item) {
if (!is_object($item) && !is_array($item)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method WeryfikujNazwaAdresUlicAdresowy
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $provinceName,
string $districtName,
string $communeName,
string $cityName,
string $cityTypeName = null,
Method WyszukajMiejscowoscWJPT
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $provinceName,
string $districtName,
string $communeName,
string $cityName,
string $cityId = null
Method WeryfikujAdresWmiejscowosci
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $provinceName,
string $districtName,
string $communeName,
string $cityName,
string $cityTypeName = null
Method __doRequest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __doRequest($request, $location, $action, $version, $oneWay = 0)
Method WeryfikujAdresWmiejscowosciAdresowy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $provinceName,
string $districtName,
string $communeName,
string $cityName,
string $cityTypeName = null
Method WyszukajMiejscowoscWRejestrze
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $name = null,
string $cityId = null,
array $tSimc = [],
array $tTerc = [],
string $cityTypeName = NativeApi::SEARCH_CITY_TYPE_ALL
Method WyszukajUliceWRejestrze
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $name = null,
string $identityName = 'ul.',
string $streetId = null,
array $tSimc = [],
array $tTerc = []
Avoid too many return
statements within this method. Open
return new Exception('Unknown Exception', 1, $e);
Avoid too many return
statements within this method. Open
return $e;