carno-php /
mysql
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * Get data |
||||||
| 4 | * User: moyo |
||||||
| 5 | * Date: 22/12/2017 |
||||||
| 6 | * Time: 4:45 PM |
||||||
| 7 | */ |
||||||
| 8 | |||||||
| 9 | namespace Carno\Database\SQL\Actions; |
||||||
| 10 | |||||||
| 11 | use Carno\Database\Results\Selected; |
||||||
| 12 | use Carno\Database\SQL\Action; |
||||||
| 13 | |||||||
| 14 | trait Getter |
||||||
| 15 | { |
||||||
| 16 | /** |
||||||
| 17 | * @return array |
||||||
| 18 | */ |
||||||
| 19 | public function get() |
||||||
| 20 | { |
||||||
| 21 | $this->actTrigger(Action::SELECT, $this); |
||||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||||
| 22 | |||||||
| 23 | $this->limit(1); |
||||||
|
0 ignored issues
–
show
It seems like
limit() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 24 | |||||||
| 25 | /** |
||||||
| 26 | * @var Selected $rows |
||||||
| 27 | */ |
||||||
| 28 | $rows = yield $this->exec($this->sql(Action::SELECT)); |
||||||
|
0 ignored issues
–
show
It seems like
sql() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
It seems like
exec() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 29 | if ($rows->count() > 0) { |
||||||
| 30 | return (yield $this->rsTrigger((array)$rows))[0]; |
||||||
|
0 ignored issues
–
show
It seems like
rsTrigger() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 31 | } |
||||||
| 32 | |||||||
| 33 | return []; |
||||||
| 34 | } |
||||||
| 35 | |||||||
| 36 | /** |
||||||
| 37 | * @return array |
||||||
| 38 | */ |
||||||
| 39 | public function list() |
||||||
| 40 | { |
||||||
| 41 | $this->actTrigger(Action::SELECT, $this); |
||||||
| 42 | |||||||
| 43 | /** |
||||||
| 44 | * @var Selected $rows |
||||||
| 45 | */ |
||||||
| 46 | $rows = yield $this->exec($this->sql(Action::SELECT)); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 47 | if ($rows->count() > 0) { |
||||||
| 48 | return yield $this->rsTrigger((array)$rows); |
||||||
| 49 | } |
||||||
| 50 | |||||||
| 51 | return []; |
||||||
| 52 | } |
||||||
| 53 | } |
||||||
| 54 |