Conditions | 4 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | protected function serve($port = 8000) |
||
13 | { |
||
14 | $continue = true; |
||
15 | do { |
||
16 | if ($this->check_port($port)) { |
||
|
|||
17 | $this->output->writeln('<info>Running php artisan serve --port='.$port.'</info>'); |
||
18 | exec('php artisan serve --port='.$port.' > /dev/null 2>&1 &'); |
||
19 | sleep(1); |
||
20 | if (file_exists('/usr/bin/sensible-browser')) { |
||
21 | $this->output->writeln('<info>Opening http://localhost:'.$port.' with default browser</info>'); |
||
22 | passthru('/usr/bin/sensible-browser http://localhost:'.$port); |
||
23 | } |
||
24 | $continue = false; |
||
25 | } |
||
26 | ++$port; |
||
27 | } while ($continue); |
||
28 | } |
||
29 | } |
||
30 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.