Total Complexity | 9 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | trait ProjectTrait |
||
9 | { |
||
10 | /** |
||
11 | * Verify Package and Project Existence. |
||
12 | * |
||
13 | * @param string $package Path to Package |
||
14 | * @param string $project Path to Project |
||
15 | */ |
||
16 | public function verifyPackageAndProjectDoesExist($package, $project) |
||
17 | { |
||
18 | $this->verifyProjectDoesExist($project); |
||
19 | $this->verifyPackageDoesExist($package); |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Verify that the Laravel Project exist. |
||
24 | * |
||
25 | * @param string $directory |
||
26 | */ |
||
27 | protected function verifyProjectDoesExist($directory) |
||
28 | { |
||
29 | if (! is_dir($directory)) { |
||
30 | throw new LaravelProjectException('Laravel Project does not exists!'); |
||
31 | } |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Verify that the package does not already exist. |
||
36 | * |
||
37 | * @param string $directory |
||
38 | */ |
||
39 | protected function verifyPackageDoesExist($directory) |
||
40 | { |
||
41 | if (! is_dir($directory)) { |
||
42 | throw new LaravelProjectException('Package does not exists!'); |
||
43 | } |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Verify that the package does not already exist. |
||
48 | * |
||
49 | * @param string $directory |
||
50 | */ |
||
51 | protected function verifyPackageDoesntExist($directory) |
||
55 | } |
||
56 | } |
||
57 | } |
||
58 |