| @@ 9-32 (lines=24) @@ | ||
| 6 | use Solidifier\Visitors\ObjectType; |
|
| 7 | use PhpParser\Node\Stmt\Property; |
|
| 8 | ||
| 9 | class PublicAttribute extends Defect |
|
| 10 | { |
|
| 11 | private |
|
| 12 | $objectType, |
|
| 13 | $property; |
|
| 14 | ||
| 15 | public function __construct(ObjectType $objectType, $property, Property $node) |
|
| 16 | { |
|
| 17 | parent::__construct($node); |
|
| 18 | ||
| 19 | $this->objectType = $objectType; |
|
| 20 | $this->property = $property; |
|
| 21 | } |
|
| 22 | ||
| 23 | public function getMessage() |
|
| 24 | { |
|
| 25 | return sprintf( |
|
| 26 | 'Public property <id>%s</id> in %s <type>%s</type>', |
|
| 27 | $this->property, |
|
| 28 | $this->objectType->type, |
|
| 29 | $this->objectType->fullname |
|
| 30 | ); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 9-30 (lines=22) @@ | ||
| 6 | use Solidifier\Visitors\ObjectType; |
|
| 7 | use PhpParser\Node\Expr\New_; |
|
| 8 | ||
| 9 | class StrongCoupling extends Defect |
|
| 10 | { |
|
| 11 | private |
|
| 12 | $objectType; |
|
| 13 | ||
| 14 | public function __construct(ObjectType $objectType, New_ $node) |
|
| 15 | { |
|
| 16 | parent::__construct($node); |
|
| 17 | ||
| 18 | $this->objectType = $objectType; |
|
| 19 | } |
|
| 20 | ||
| 21 | public function getMessage() |
|
| 22 | { |
|
| 23 | return sprintf( |
|
| 24 | 'Allocation in %s <type>%s</type> (instanciate %s)', |
|
| 25 | $this->objectType->type, |
|
| 26 | $this->objectType->fullname, |
|
| 27 | $this->node->class |
|
| 28 | ); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||