| Total Complexity | 1 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| Metric | Value |
|---|---|
| wmc | 1 |
| lcom | 1 |
| cbo | 3 |
| dl | 0 |
| loc | 40 |
| rs | 10 |
| c | 0 |
| b | 0 |
| f | 0 |
| ccs | 30 |
| cts | 30 |
| cp | 1 |
| Rating | Name | Duplication | Size | Complexity |
|---|---|---|---|---|
| B | serialise() | 0 | 33 | 1 |
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * This file is part of graze/unicontroller-client. |
||
| 4 | * |
||
| 5 | * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com> |
||
| 6 | * |
||
| 7 | * For the full copyright and license information, please view the LICENSE |
||
| 8 | * file that was distributed with this source code. |
||
| 9 | * |
||
| 10 | * @license https://github.com/graze/unicontroller-client/blob/master/LICENSE.md |
||
| 11 | * @link https://github.com/graze/unicontroller-client |
||
| 12 | */ |
||
| 13 | namespace Graze\UnicontrollerClient\Serialiser\Serialiser; |
||
| 14 | |||
| 15 | use Graze\UnicontrollerClient\Serialiser\Serialiser\AbstractSerialiser; |
||
| 16 | use Graze\UnicontrollerClient\Serialiser\Serialiser\SerialiserInterface; |
||
| 17 | use Graze\UnicontrollerClient\Entity\Entity\EntityInterface; |
||
| 18 | |||
| 19 | class SerialiserReadDesign extends AbstractSerialiser implements SerialiserInterface |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @param EntityInterface $entity |
||
| 23 | * @return string |
||
| 24 | */ |
||
| 25 | 1 | public function serialise(EntityInterface $entity) |
|
| 26 | { |
||
| 27 | 1 | $properties = []; |
|
| 28 | 1 | $properties[] = $this->stringEscaper->escape($entity->getName()); |
|
|
0 ignored issues
–
show
|
|||
| 29 | 1 | $properties[] = $entity->getHeight(); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getHeight() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...ntity\EntityBarcodeItem, Graze\UnicontrollerClien...ty\Entity\EntityBoxItem, Graze\UnicontrollerClien...y\Entity\EntityLineItem, Graze\UnicontrollerClien...ntity\EntityPictureItem, Graze\UnicontrollerClien...Entity\EntityReadDesign, Graze\UnicontrollerClien...ty\Entity\EntityTtfItem.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 30 | 1 | $properties[] = $entity->getWidth(); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getWidth() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...ty\Entity\EntityBoxItem, Graze\UnicontrollerClien...y\Entity\EntityLineItem, Graze\UnicontrollerClien...ntity\EntityPictureItem, Graze\UnicontrollerClien...Entity\EntityReadDesign, Graze\UnicontrollerClien...ty\Entity\EntityTtfItem.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 31 | 1 | $properties[] = $entity->getStorageMode(); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getStorageMode() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 32 | 1 | $properties[] = $entity->getSaveDesign(); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getSaveDesign() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 33 | 1 | $properties[] = $entity->getPrintDesign(); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getPrintDesign() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 34 | 1 | $properties[] = $entity->getDriverId(); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getDriverId() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 35 | 1 | $properties[] = $entity->getPrintCount(); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getPrintCount() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 36 | 1 | $properties[] = $entity->getCycleSize(); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getCycleSize() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 37 | 1 | $properties[] = $entity->getReadOk(); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getReadOk() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 38 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getLineArray(), 'LineItem'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getLineArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 39 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getBoxArray(), 'BoxItem'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getBoxArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 40 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getTtfArray(), 'TtfItem'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getTtfArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 41 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getBarcodeArray(), 'BarcodeItem'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getBarcodeArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 42 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getPictureArray(), 'PictureItem'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getPictureArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 43 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getPromptArray(), 'VarPrompt'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getPromptArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 44 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getSeqArray(), 'VarSeq'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getSeqArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 45 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getRtcArray(), 'VarRtc'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getRtcArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 46 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getDatabaseArray(), 'VarDatabase'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getDatabaseArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 47 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getUserIdArray(), 'VarUserId'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getUserIdArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 48 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getShiftCodeArray(), 'VarShiftCode'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getShiftCodeArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 49 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getMachineIdArray(), 'VarMachineId'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getMachineIdArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 50 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getDatabaseFieldArray(), 'VarDatabaseField'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getDatabaseFieldArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 51 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getMacroArray(), 'VarMacro'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getMacroArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 52 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getMacroOutputArray(), 'VarMacroOutput'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getMacroOutputArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 53 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getSerialVarArray(), 'VarSerial'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getSerialVarArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 54 | 1 | $properties[] = $this->arraySerialiser->serialise($entity->getSettingsArray(), 'SettingsById'); |
|
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
Graze\UnicontrollerClien...\Entity\EntityInterface as the method getSettingsArray() does only exist in the following implementations of said interface: Graze\UnicontrollerClien...Entity\EntityReadDesign.
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
Loading history...
|
|||
| 55 | |||
| 56 | 1 | return implode(',', $properties); |
|
| 57 | } |
||
| 58 | } |
||
| 59 |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the interface: