@@ -42,7 +42,7 @@ |
||
42 | 42 | * Source a model from an argument. |
43 | 43 | * |
44 | 44 | * @param $arg |
45 | - * @return mixed |
|
45 | + * @return TrackableResourceModel |
|
46 | 46 | */ |
47 | 47 | protected function sourceModel($arg) |
48 | 48 | { |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $arg = TrackableResourceModel::findOrFail($arg); |
51 | 51 | } |
52 | 52 | |
53 | - if (! $arg instanceof TrackableResourceModel) { |
|
53 | + if (!$arg instanceof TrackableResourceModel) { |
|
54 | 54 | $name = ('object' === gettype($arg)) ? get_class($arg) : 'object'; |
55 | 55 | |
56 | 56 | throw new InvalidArgumentException( |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * @param \Illuminate\Http\Request $request |
37 | 37 | * @param \BoxedCode\Tracking\TrackableResourceModel $model |
38 | - * @return mixed |
|
38 | + * @return \Illuminate\Http\RedirectResponse |
|
39 | 39 | */ |
40 | 40 | public function handle(Request $request, TrackableResourceModel $model) |
41 | 41 | { |
@@ -54,13 +54,13 @@ |
||
54 | 54 | */ |
55 | 55 | public function getModelAttributes(array $args) |
56 | 56 | { |
57 | - if (! isset($args[0]) || ! filter_var($args[0], FILTER_VALIDATE_URL)) { |
|
57 | + if (!isset($args[0]) || !filter_var($args[0], FILTER_VALIDATE_URL)) { |
|
58 | 58 | $url = isset($args[0]) ? (string) $args[0] : 'none'; |
59 | 59 | |
60 | 60 | throw new InvalidArgumentException("Invalid url provided. [$url]"); |
61 | 61 | } |
62 | 62 | |
63 | - if (isset($args[1]) && ! is_int($args[1])) { |
|
63 | + if (isset($args[1]) && !is_int($args[1])) { |
|
64 | 64 | throw new InvalidArgumentException("Invalid status code. [$args[1]]"); |
65 | 65 | } |
66 | 66 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function up() |
24 | 24 | { |
25 | - Schema::create('trackable_resources', function (Blueprint $table) { |
|
25 | + Schema::create('trackable_resources', function(Blueprint $table) { |
|
26 | 26 | $table->string('id', 7)->primaryKey(); |
27 | 27 | $table->string('type'); |
28 | 28 | $table->text('resource')->nullable(); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function setMetaAttribute($value = []) |
36 | 36 | { |
37 | - if (! is_null($value)) { |
|
37 | + if (!is_null($value)) { |
|
38 | 38 | $this->attributes['meta'] = serialize($value); |
39 | 39 | } else { |
40 | 40 | $this->attributes['meta'] = null; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getMetaAttribute() |
50 | 50 | { |
51 | - if (isset($this->attributes['meta']) && ! empty($this->attributes['meta'])) { |
|
51 | + if (isset($this->attributes['meta']) && !empty($this->attributes['meta'])) { |
|
52 | 52 | return unserialize($this->attributes['meta']); |
53 | 53 | } |
54 | 54 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | protected function registerFactory() |
28 | 28 | { |
29 | - $this->app->singleton(TrackerFactory::class, function ($app) { |
|
29 | + $this->app->singleton(TrackerFactory::class, function($app) { |
|
30 | 30 | $trackers = [ |
31 | 31 | PixelTracker::class, |
32 | 32 | RedirectTracker::class, |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function registerTrackers() |
45 | 45 | { |
46 | - $this->app->bind(PixelTracker::class, function ($app) { |
|
46 | + $this->app->bind(PixelTracker::class, function($app) { |
|
47 | 47 | return new PixelTracker($app, $app['events'], $app['config']); |
48 | 48 | }); |
49 | 49 | |
50 | - $this->app->bind(RedirectTracker::class, function ($app) { |
|
50 | + $this->app->bind(RedirectTracker::class, function($app) { |
|
51 | 51 | return new RedirectTracker($app, $app['events'], $app['config']); |
52 | 52 | }); |
53 | 53 | } |
@@ -215,7 +215,7 @@ |
||
215 | 215 | * Get a 'trackable' url for the current data model. |
216 | 216 | * |
217 | 217 | * @param array $parameters |
218 | - * @return \League\Url\Url |
|
218 | + * @return string |
|
219 | 219 | */ |
220 | 220 | public function getTrackedUrl($parameters = []) |
221 | 221 | { |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | { |
176 | 176 | $path = $this->getRoutingPath(); |
177 | 177 | |
178 | - $router->get($path, ['as' => $this->route_name, function (Request $request, $id) { |
|
179 | - if (! ($model = TrackableResourceModel::find($id))) { |
|
178 | + $router->get($path, ['as' => $this->route_name, function(Request $request, $id) { |
|
179 | + if (!($model = TrackableResourceModel::find($id))) { |
|
180 | 180 | abort(404); |
181 | 181 | } |
182 | 182 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - return $url . $params; |
|
236 | + return $url.$params; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function getUniqueId() |
245 | 245 | { |
246 | - while (! isset($id) || TrackableResourceModel::find($id)) { |
|
246 | + while (!isset($id) || TrackableResourceModel::find($id)) { |
|
247 | 247 | $id = str_random(6); |
248 | 248 | } |
249 | 249 |