1: | <?php declare(strict_types=1); |
2: | |
3: | namespace Salient\Sync\Reflection; |
4: | |
5: | use Salient\Contract\Sync\SyncEntityInterface; |
6: | use ReflectionClass; |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | class ReflectionSyncEntity extends ReflectionClass |
14: | { |
15: | use SyncReflectionTrait; |
16: | |
17: | |
18: | |
19: | |
20: | public function __construct($entity) |
21: | { |
22: | $this->assertImplements($entity, SyncEntityInterface::class); |
23: | parent::__construct($entity); |
24: | } |
25: | |
26: | |
27: | |
28: | |
29: | |
30: | |
31: | |
32: | public function getPluralName(): ?string |
33: | { |
34: | |
35: | $plural = $this->getMethod('getPlural')->invoke(null); |
36: | if ($plural !== null && !strcasecmp($plural, $this->getShortName())) { |
37: | return null; |
38: | } |
39: | return $plural; |
40: | } |
41: | } |
42: | |