| Total Complexity | 5 |
| Total Lines | 106 |
| Duplicated Lines | 0 % |
| Coverage | 87.5% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class Roles extends AbstractModel |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * |
||
| 13 | * @var integer |
||
| 14 | */ |
||
| 15 | public $id; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * |
||
| 19 | * @var integer |
||
| 20 | */ |
||
| 21 | public $name; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * |
||
| 25 | * @var integer |
||
| 26 | */ |
||
| 27 | public $description; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * |
||
| 31 | * @var integer |
||
| 32 | */ |
||
| 33 | public $scope; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * |
||
| 37 | * @var integer |
||
| 38 | */ |
||
| 39 | public $company_id; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * |
||
| 43 | * @var int |
||
| 44 | */ |
||
| 45 | public $apps_id; |
||
| 46 | |||
| 47 | /** |
||
| 48 | * |
||
| 49 | * @var string |
||
| 50 | */ |
||
| 51 | public $created_at; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * |
||
| 55 | * @var string |
||
| 56 | */ |
||
| 57 | public $updated_at; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * |
||
| 61 | * @var integer |
||
| 62 | */ |
||
| 63 | public $is_deleted; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Default ACL company |
||
| 67 | * |
||
| 68 | */ |
||
| 69 | const DEFAULT_ACL_COMPANY_ID = 0; |
||
| 70 | const DEFAULT_ACL_APP_ID = 0; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Initialize method for model. |
||
| 74 | */ |
||
| 75 | 4 | public function initialize() |
|
| 76 | { |
||
| 77 | 4 | $this->setSource('roles'); |
|
| 78 | 4 | } |
|
| 79 | |||
| 80 | /** |
||
| 81 | * Returns table name mapped in the model. |
||
| 82 | * |
||
| 83 | * @return string |
||
| 84 | */ |
||
| 85 | 4 | public function getSource(): string |
|
| 86 | { |
||
| 87 | 4 | return 'roles'; |
|
| 88 | } |
||
| 89 | |||
| 90 | /** |
||
| 91 | * Get the Role by it app name |
||
| 92 | * |
||
| 93 | * @param string $role |
||
| 94 | * @return Roles |
||
| 95 | */ |
||
| 96 | 2 | public function getByAppName(string $role, Companies $company): Roles |
|
| 115 | ]); |
||
| 116 | } |
||
| 117 | } |
||
| 118 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: