deltcod /
LaravelTube
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Http\Controllers; |
||
| 4 | |||
| 5 | use App\Events\LikeDislikePush; |
||
| 6 | use App\Http\Requests\LikeDislikeStoreRequest; |
||
| 7 | use App\Repositories\LikeDislikeRepository as LikeDislike; |
||
| 8 | use App\Transformers\LikeDislikeTransformer; |
||
| 9 | use Chrisbjr\ApiGuard\Http\Controllers\ApiGuardController; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Class LikeDislikeController. |
||
| 13 | */ |
||
| 14 | class LikeDislikeController extends ApiGuardController |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var LikeDislikeTransformer |
||
| 18 | */ |
||
| 19 | protected $likeDislikeTransformer; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * LikeDislike repository. |
||
| 23 | * |
||
| 24 | * @var LikeDislike |
||
| 25 | */ |
||
| 26 | private $likeDislike; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var array |
||
| 30 | */ |
||
| 31 | protected $apiMethods = [ |
||
| 32 | 'getLikes' => [ |
||
| 33 | 'keyAuthentication' => false, |
||
| 34 | ], |
||
| 35 | 'getDislikes' => [ |
||
| 36 | 'keyAuthentication' => false, |
||
| 37 | ], |
||
| 38 | 'getLikesCount' => [ |
||
| 39 | 'keyAuthentication' => false, |
||
| 40 | ], |
||
| 41 | 'getDislikesCount' => [ |
||
| 42 | 'keyAuthentication' => false, |
||
| 43 | ], |
||
| 44 | ]; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * LikeDislikeController constructor. |
||
| 48 | * |
||
| 49 | * @param LikeDislike $likeDislike |
||
| 50 | * @param LikeDislikeTransformer $likeDislikeTransformer |
||
| 51 | */ |
||
| 52 | 7 | public function __construct(LikeDislike $likeDislike, LikeDislikeTransformer $likeDislikeTransformer) |
|
| 53 | { |
||
| 54 | 7 | parent::__construct(); |
|
| 55 | |||
| 56 | 7 | $this->likeDislikeTransformer = $likeDislikeTransformer; |
|
| 57 | 7 | $this->likeDislike = $likeDislike; |
|
| 58 | 7 | } |
|
| 59 | |||
| 60 | /** |
||
| 61 | * Return likes. |
||
| 62 | * |
||
| 63 | * @param $id |
||
| 64 | * |
||
| 65 | * @return mixed |
||
| 66 | */ |
||
| 67 | 3 | public function getLikes($id) |
|
| 68 | { |
||
| 69 | 3 | $likes = $this->likeDislike->getLikesAll($id); |
|
| 70 | |||
| 71 | 3 | return $this->response->withCollection($likes, $this->likeDislikeTransformer); |
|
|
0 ignored issues
–
show
|
|||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Return likes count. |
||
| 76 | * |
||
| 77 | * @param $id |
||
| 78 | * |
||
| 79 | * @return mixed |
||
| 80 | */ |
||
| 81 | 1 | public function getLikesCount($id) |
|
| 82 | { |
||
| 83 | 1 | $count = $this->likeDislike->getLikesCount($id); |
|
| 84 | |||
| 85 | 1 | return $count; |
|
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * Return dislikes. |
||
| 90 | * |
||
| 91 | * @param $id |
||
| 92 | * |
||
| 93 | * @return mixed |
||
| 94 | */ |
||
| 95 | 2 | public function getDislikes($id) |
|
| 96 | { |
||
| 97 | 2 | $dislikes = $this->likeDislike->getDislikesAll($id); |
|
| 98 | |||
| 99 | 2 | return $this->response->withCollection($dislikes, $this->likeDislikeTransformer); |
|
|
0 ignored issues
–
show
$this->likeDislikeTransformer is of type object<App\Transformers\LikeDislikeTransformer>, but the function expects a callable.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Return dislikes count. |
||
| 104 | * |
||
| 105 | * @param $id |
||
| 106 | * |
||
| 107 | * @return mixed |
||
| 108 | */ |
||
| 109 | 1 | public function getDislikesCount($id) |
|
| 110 | { |
||
| 111 | 1 | $count = $this->likeDislike->getDislikesCount($id); |
|
| 112 | |||
| 113 | 1 | return $count; |
|
| 114 | } |
||
| 115 | |||
| 116 | /** |
||
| 117 | * Create and store like or dislike. |
||
| 118 | * |
||
| 119 | * @param LikeDislikeStoreRequest $request |
||
| 120 | * |
||
| 121 | * @return mixed |
||
| 122 | */ |
||
| 123 | 3 | public function store(LikeDislikeStoreRequest $request) |
|
| 124 | { |
||
| 125 | 3 | $check = $this->likeDislike->checkIfDataExists($request); |
|
| 126 | |||
| 127 | 3 | if ($check == 0) { |
|
| 128 | 1 | $like = $this->likeDislike->create($request->all()); |
|
| 129 | 1 | $this->callEventPushLikeDislike($like); |
|
| 130 | |||
| 131 | 1 | return $this->response->withItem($like, $this->likeDislikeTransformer); |
|
|
0 ignored issues
–
show
$this->likeDislikeTransformer is of type object<App\Transformers\LikeDislikeTransformer>, but the function expects a callable.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 132 | } else { |
||
| 133 | 2 | $like = $this->likeDislike->findOrFail($check); |
|
| 134 | 2 | $this->callEventPushLikeDislike($like); |
|
| 135 | 2 | if ($request->input('type') != $like->type) { |
|
| 136 | 1 | $like = $this->likeDislike->update($request->all(), $like->id); |
|
| 137 | |||
| 138 | 1 | return $this->response->withItem($like, $this->likeDislikeTransformer); |
|
|
0 ignored issues
–
show
$this->likeDislikeTransformer is of type object<App\Transformers\LikeDislikeTransformer>, but the function expects a callable.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 139 | } else { |
||
| 140 | 1 | $this->likeDislike->delete($like->id); |
|
| 141 | } |
||
| 142 | } |
||
| 143 | 1 | } |
|
| 144 | |||
| 145 | /** |
||
| 146 | * Call event push like/dislike. |
||
| 147 | * |
||
| 148 | * @param $likeDislike |
||
| 149 | */ |
||
| 150 | 3 | private function callEventPushLikeDislike($likeDislike) |
|
| 151 | { |
||
| 152 | 3 | event(new LikeDislikePush($likeDislike)); |
|
| 153 | 3 | } |
|
| 154 | } |
||
| 155 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: