@@ -315,7 +315,7 @@ |
||
| 315 | 315 | /** |
| 316 | 316 | * Add a piece of shared data to the environment. |
| 317 | 317 | * |
| 318 | - * @param array|string $key |
|
| 318 | + * @param string $key |
|
| 319 | 319 | * @param mixed $value |
| 320 | 320 | * @return mixed |
| 321 | 321 | */ |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function getEngineFromPath($path) |
| 304 | 304 | { |
| 305 | - if (! $extension = $this->getExtension($path)) { |
|
| 305 | + if (!$extension = $this->getExtension($path)) { |
|
| 306 | 306 | throw new InvalidArgumentException("Unrecognized extension in file: $path"); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | { |
| 322 | 322 | $extensions = array_keys($this->extensions); |
| 323 | 323 | |
| 324 | - return Arr::first($extensions, function ($key, $value) use ($path) { |
|
| 324 | + return Arr::first($extensions, function($key, $value) use ($path) { |
|
| 325 | 325 | return Str::endsWith($path, '.'.$value); |
| 326 | 326 | }); |
| 327 | 327 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public function share($key, $value = null) |
| 337 | 337 | { |
| 338 | - if (! is_array($key)) { |
|
| 338 | + if (!is_array($key)) { |
|
| 339 | 339 | return $this->shared[$key] = $value; |
| 340 | 340 | } |
| 341 | 341 | |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | // Once we have the class and method name, we can build the Closure to resolve |
| 475 | 475 | // the instance out of the IoC container and call the method on it with the |
| 476 | 476 | // given arguments that are passed to the Closure as the composer's data. |
| 477 | - return function () use ($class, $method) { |
|
| 477 | + return function() use ($class, $method) { |
|
| 478 | 478 | $callable = [$this->container->make($class), $method]; |
| 479 | 479 | |
| 480 | 480 | return call_user_func_array($callable, func_get_args()); |
@@ -696,10 +696,10 @@ discard block |
||
| 696 | 696 | */ |
| 697 | 697 | protected function extendPush($section, $content) |
| 698 | 698 | { |
| 699 | - if (! isset($this->pushes[$section])) { |
|
| 699 | + if (!isset($this->pushes[$section])) { |
|
| 700 | 700 | $this->pushes[$section] = []; |
| 701 | 701 | } |
| 702 | - if (! isset($this->pushes[$section][$this->renderCount])) { |
|
| 702 | + if (!isset($this->pushes[$section][$this->renderCount])) { |
|
| 703 | 703 | $this->pushes[$section][$this->renderCount] = $content; |
| 704 | 704 | } else { |
| 705 | 705 | $this->pushes[$section][$this->renderCount] .= $content; |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | */ |
| 716 | 716 | public function yieldPushContent($section, $default = '') |
| 717 | 717 | { |
| 718 | - if (! isset($this->pushes[$section])) { |
|
| 718 | + if (!isset($this->pushes[$section])) { |
|
| 719 | 719 | return $default; |
| 720 | 720 | } |
| 721 | 721 | |
@@ -367,7 +367,7 @@ |
||
| 367 | 367 | * Remove a piece of bound data from the view. |
| 368 | 368 | * |
| 369 | 369 | * @param string $key |
| 370 | - * @return bool |
|
| 370 | + * @return boolean|null |
|
| 371 | 371 | */ |
| 372 | 372 | public function __unset($key) |
| 373 | 373 | { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | // another view gets rendered in the future by the application developer. |
| 90 | 90 | $this->factory->flushSectionsIfDoneRendering(); |
| 91 | 91 | |
| 92 | - return ! is_null($response) ? $response : $contents; |
|
| 92 | + return !is_null($response) ? $response : $contents; |
|
| 93 | 93 | } catch (Exception $e) { |
| 94 | 94 | $this->factory->flushSections(); |
| 95 | 95 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function renderSections() |
| 134 | 134 | { |
| 135 | - return $this->render(function () { |
|
| 135 | + return $this->render(function() { |
|
| 136 | 136 | return $this->factory->getSections(); |
| 137 | 137 | }); |
| 138 | 138 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * Check if a component is registered. |
| 34 | 34 | * |
| 35 | - * @param $name |
|
| 35 | + * @param string $name |
|
| 36 | 36 | * |
| 37 | 37 | * @return bool |
| 38 | 38 | */ |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | /** |
| 45 | 45 | * Render a custom component. |
| 46 | 46 | * |
| 47 | - * @param $name |
|
| 47 | + * @param string $name |
|
| 48 | 48 | * @param array $arguments |
| 49 | 49 | * |
| 50 | - * @return \Illuminate\Contracts\View\View |
|
| 50 | + * @return HtmlString |
|
| 51 | 51 | */ |
| 52 | 52 | protected function renderComponent($name, array $arguments) |
| 53 | 53 | { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param string $method |
| 96 | 96 | * @param array $parameters |
| 97 | 97 | * |
| 98 | - * @return \Illuminate\Contracts\View\View|mixed |
|
| 98 | + * @return HtmlString |
|
| 99 | 99 | * |
| 100 | 100 | * @throws \BadMethodCallException |
| 101 | 101 | */ |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $data = $this->getComponentData($component['signature'], $arguments); |
| 56 | 56 | |
| 57 | 57 | return new HtmlString( |
| 58 | - $this->view->make($component['view'], $data)->render() |
|
| 58 | + $this->view->make($component['view'], $data)->render() |
|
| 59 | 59 | ); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * @param $key |
|
| 48 | + * @param string $key |
|
| 49 | 49 | * |
| 50 | 50 | * @return bool |
| 51 | 51 | */ |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * @param $key |
|
| 65 | + * @param string $key |
|
| 66 | 66 | * @param $value |
| 67 | 67 | * |
| 68 | 68 | * @return mixed |
@@ -54,9 +54,9 @@ |
||
| 54 | 54 | $methods = $this->getReflection()->getMethods(ReflectionMethod::IS_PUBLIC); |
| 55 | 55 | |
| 56 | 56 | $mutator = collect($methods) |
| 57 | - ->first(function ($index, ReflectionMethod $method) use ($key) { |
|
| 58 | - return $method->getName() == 'form' . Str::studly($key) . 'Attribute'; |
|
| 59 | - }); |
|
| 57 | + ->first(function ($index, ReflectionMethod $method) use ($key) { |
|
| 58 | + return $method->getName() == 'form' . Str::studly($key) . 'Attribute'; |
|
| 59 | + }); |
|
| 60 | 60 | |
| 61 | 61 | return (bool) $mutator; |
| 62 | 62 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | // instance on retrieval, which makes it quite convenient to work with |
| 30 | 30 | // date fields without having to create a mutator for each property. |
| 31 | 31 | if (in_array($key, $this->getDates())) { |
| 32 | - if (! is_null($value)) { |
|
| 32 | + if (!is_null($value)) { |
|
| 33 | 33 | $value = $this->asDateTime($value); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | $methods = $this->getReflection()->getMethods(ReflectionMethod::IS_PUBLIC); |
| 55 | 55 | |
| 56 | 56 | $mutator = collect($methods) |
| 57 | - ->first(function ($index, ReflectionMethod $method) use ($key) { |
|
| 58 | - return $method->getName() == 'form' . Str::studly($key) . 'Attribute'; |
|
| 57 | + ->first(function($index, ReflectionMethod $method) use ($key) { |
|
| 58 | + return $method->getName() == 'form'.Str::studly($key).'Attribute'; |
|
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | 61 | return (bool) $mutator; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | private function mutateFormAttribute($key, $value) |
| 71 | 71 | { |
| 72 | - return $this->{'form' . Str::studly($key) . 'Attribute'}($value); |
|
| 72 | + return $this->{'form'.Str::studly($key).'Attribute'}($value); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | protected function getReflection() |
| 80 | 80 | { |
| 81 | - if (! $this->reflection) { |
|
| 81 | + if (!$this->reflection) { |
|
| 82 | 82 | $this->reflection = new ReflectionClass($this); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | /** |
| 182 | 182 | * Close the current form. |
| 183 | 183 | * |
| 184 | - * @return string |
|
| 184 | + * @return HtmlString |
|
| 185 | 185 | */ |
| 186 | 186 | public function close() |
| 187 | 187 | { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | /** |
| 196 | 196 | * Generate a hidden field with the current CSRF token. |
| 197 | 197 | * |
| 198 | - * @return string |
|
| 198 | + * @return HtmlString |
|
| 199 | 199 | */ |
| 200 | 200 | public function token() |
| 201 | 201 | { |
@@ -589,11 +589,6 @@ discard block |
||
| 589 | 589 | /** |
| 590 | 590 | * Create a select year field. |
| 591 | 591 | * |
| 592 | - * @param string $name |
|
| 593 | - * @param string $begin |
|
| 594 | - * @param string $end |
|
| 595 | - * @param string $selected |
|
| 596 | - * @param array $options |
|
| 597 | 592 | * |
| 598 | 593 | * @return mixed |
| 599 | 594 | */ |
@@ -682,7 +677,7 @@ discard block |
||
| 682 | 677 | /** |
| 683 | 678 | * Create a placeholder select element option. |
| 684 | 679 | * |
| 685 | - * @param $display |
|
| 680 | + * @param string $display |
|
| 686 | 681 | * @param $selected |
| 687 | 682 | * |
| 688 | 683 | * @return \Illuminate\Support\HtmlString |
@@ -718,7 +713,7 @@ discard block |
||
| 718 | 713 | * Create a checkbox input field. |
| 719 | 714 | * |
| 720 | 715 | * @param string $name |
| 721 | - * @param mixed $value |
|
| 716 | + * @param integer $value |
|
| 722 | 717 | * @param bool $checked |
| 723 | 718 | * @param array $options |
| 724 | 719 | * |
@@ -1138,7 +1133,7 @@ discard block |
||
| 1138 | 1133 | * |
| 1139 | 1134 | * @param string $key |
| 1140 | 1135 | * |
| 1141 | - * @return mixed |
|
| 1136 | + * @return string |
|
| 1142 | 1137 | */ |
| 1143 | 1138 | protected function transformKey($key) |
| 1144 | 1139 | { |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | // is used to spoof requests for this PUT, PATCH, etc. methods on forms. |
| 140 | 140 | $attributes = array_merge( |
| 141 | 141 | |
| 142 | - $attributes, array_except($options, $this->reserved) |
|
| 142 | + $attributes, array_except($options, $this->reserved) |
|
| 143 | 143 | |
| 144 | 144 | ); |
| 145 | 145 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | // extra value for the hidden _method field if it's needed for the form. |
| 149 | 149 | $attributes = $this->html->attributes($attributes); |
| 150 | 150 | |
| 151 | - return $this->toHtmlString('<form' . $attributes . '>' . $append); |
|
| 151 | + return $this->toHtmlString('<form'.$attributes.'>'.$append); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function token() |
| 201 | 201 | { |
| 202 | - $token = ! empty($this->csrfToken) ? $this->csrfToken : $this->session->getToken(); |
|
| 202 | + $token = !empty($this->csrfToken) ? $this->csrfToken : $this->session->getToken(); |
|
| 203 | 203 | |
| 204 | 204 | return $this->hidden('_token', $token); |
| 205 | 205 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | $value = e($this->formatLabel($name, $value)); |
| 223 | 223 | |
| 224 | - return $this->toHtmlString('<label for="' . $name . '"' . $options . '>' . $value . '</label>'); |
|
| 224 | + return $this->toHtmlString('<label for="'.$name.'"'.$options.'>'.$value.'</label>'); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function input($type, $name, $value = null, $options = []) |
| 251 | 251 | { |
| 252 | - if (! isset($options['name'])) { |
|
| 252 | + if (!isset($options['name'])) { |
|
| 253 | 253 | $options['name'] = $name; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | // in the model instance if one is set. Otherwise we will just use empty. |
| 259 | 259 | $id = $this->getIdAttribute($name, $options); |
| 260 | 260 | |
| 261 | - if (! in_array($type, $this->skipValueTypes)) { |
|
| 261 | + if (!in_array($type, $this->skipValueTypes)) { |
|
| 262 | 262 | $value = $this->getValueAttribute($name, $value); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | $options = array_merge($options, $merge); |
| 271 | 271 | |
| 272 | - return $this->toHtmlString('<input' . $this->html->attributes($options) . '>'); |
|
| 272 | + return $this->toHtmlString('<input'.$this->html->attributes($options).'>'); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | */ |
| 462 | 462 | public function textarea($name, $value = null, $options = []) |
| 463 | 463 | { |
| 464 | - if (! isset($options['name'])) { |
|
| 464 | + if (!isset($options['name'])) { |
|
| 465 | 465 | $options['name'] = $name; |
| 466 | 466 | } |
| 467 | 467 | |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | // the element. Then we'll create the final textarea elements HTML for us. |
| 482 | 482 | $options = $this->html->attributes($options); |
| 483 | 483 | |
| 484 | - return $this->toHtmlString('<textarea' . $options . '>' . e($value) . '</textarea>'); |
|
| 484 | + return $this->toHtmlString('<textarea'.$options.'>'.e($value).'</textarea>'); |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | /** |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | $options['id'] = $this->getIdAttribute($name, $options); |
| 542 | 542 | |
| 543 | - if (! isset($options['name'])) { |
|
| 543 | + if (!isset($options['name'])) { |
|
| 544 | 544 | $options['name'] = $name; |
| 545 | 545 | } |
| 546 | 546 | |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | $html[] = $this->option($display, $value, $selected); |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | - return $this->toHtmlString('<optgroup label="' . e($label) . '">' . implode('', $html) . '</optgroup>'); |
|
| 661 | + return $this->toHtmlString('<optgroup label="'.e($label).'">'.implode('', $html).'</optgroup>'); |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | /** |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | $options = ['value' => $value, 'selected' => $selected]; |
| 678 | 678 | |
| 679 | - return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . e($display) . '</option>'); |
|
| 679 | + return $this->toHtmlString('<option'.$this->html->attributes($options).'>'.e($display).'</option>'); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | /** |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | $options = compact('selected'); |
| 695 | 695 | $options['value'] = ''; |
| 696 | 696 | |
| 697 | - return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . e($display) . '</option>'); |
|
| 697 | + return $this->toHtmlString('<option'.$this->html->attributes($options).'>'.e($display).'</option>'); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | /** |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | */ |
| 806 | 806 | protected function getCheckboxCheckedState($name, $value, $checked) |
| 807 | 807 | { |
| 808 | - if (isset($this->session) && ! $this->oldInputIsEmpty() && is_null($this->old($name))) { |
|
| 808 | + if (isset($this->session) && !$this->oldInputIsEmpty() && is_null($this->old($name))) { |
|
| 809 | 809 | return false; |
| 810 | 810 | } |
| 811 | 811 | |
@@ -920,11 +920,11 @@ discard block |
||
| 920 | 920 | */ |
| 921 | 921 | public function button($value = null, $options = []) |
| 922 | 922 | { |
| 923 | - if (! array_key_exists('type', $options)) { |
|
| 923 | + if (!array_key_exists('type', $options)) { |
|
| 924 | 924 | $options['type'] = 'button'; |
| 925 | 925 | } |
| 926 | 926 | |
| 927 | - return $this->toHtmlString('<button' . $this->html->attributes($options) . '>' . $value . '</button>'); |
|
| 927 | + return $this->toHtmlString('<button'.$this->html->attributes($options).'>'.$value.'</button>'); |
|
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | /** |
@@ -1080,11 +1080,11 @@ discard block |
||
| 1080 | 1080 | return $value; |
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | - if (! is_null($this->old($name))) { |
|
| 1083 | + if (!is_null($this->old($name))) { |
|
| 1084 | 1084 | return $this->old($name); |
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | - if (! is_null($value)) { |
|
| 1087 | + if (!is_null($value)) { |
|
| 1088 | 1088 | return $value; |
| 1089 | 1089 | } |
| 1090 | 1090 | |
@@ -1,7 +1,5 @@ |
||
| 1 | 1 | <?php namespace Mmanos\Billing\CustomerBillableTrait; |
| 2 | 2 | |
| 3 | -use Illuminate\Support\Arr; |
|
| 4 | - |
|
| 5 | 3 | class Charge |
| 6 | 4 | { |
| 7 | 5 | /** |
@@ -4,141 +4,141 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Charge |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Customer model. |
|
| 9 | - * |
|
| 10 | - * @var \Illuminate\Database\Eloquent\Model |
|
| 11 | - */ |
|
| 12 | - protected $model; |
|
| 7 | + /** |
|
| 8 | + * Customer model. |
|
| 9 | + * |
|
| 10 | + * @var \Illuminate\Database\Eloquent\Model |
|
| 11 | + */ |
|
| 12 | + protected $model; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Charge gateway instance. |
|
| 16 | - * |
|
| 17 | - * @var \Mmanos\Billing\Gateways\ChargeInterface |
|
| 18 | - */ |
|
| 19 | - protected $charge; |
|
| 14 | + /** |
|
| 15 | + * Charge gateway instance. |
|
| 16 | + * |
|
| 17 | + * @var \Mmanos\Billing\Gateways\ChargeInterface |
|
| 18 | + */ |
|
| 19 | + protected $charge; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Charge info array. |
|
| 23 | - * |
|
| 24 | - * @var array |
|
| 25 | - */ |
|
| 26 | - protected $info; |
|
| 21 | + /** |
|
| 22 | + * Charge info array. |
|
| 23 | + * |
|
| 24 | + * @var array |
|
| 25 | + */ |
|
| 26 | + protected $info; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Local copy of the invoice object for this charge. |
|
| 30 | - * |
|
| 31 | - * @var Invoice |
|
| 32 | - */ |
|
| 33 | - protected $invoice; |
|
| 28 | + /** |
|
| 29 | + * Local copy of the invoice object for this charge. |
|
| 30 | + * |
|
| 31 | + * @var Invoice |
|
| 32 | + */ |
|
| 33 | + protected $invoice; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Create a new CustomerBillableTrait Charge instance. |
|
| 37 | - * |
|
| 38 | - * @param \Illuminate\Database\Eloquent\Model $model |
|
| 39 | - * @param \Mmanos\Billing\Gateways\ChargeInterface $charge |
|
| 40 | - * |
|
| 41 | - * @return void |
|
| 42 | - */ |
|
| 43 | - public function __construct(\Illuminate\Database\Eloquent\Model $model, \Mmanos\Billing\Gateways\ChargeInterface $charge) |
|
| 44 | - { |
|
| 45 | - $this->model = $model; |
|
| 46 | - $this->charge = $charge; |
|
| 47 | - $this->info = $charge->info(); |
|
| 48 | - } |
|
| 35 | + /** |
|
| 36 | + * Create a new CustomerBillableTrait Charge instance. |
|
| 37 | + * |
|
| 38 | + * @param \Illuminate\Database\Eloquent\Model $model |
|
| 39 | + * @param \Mmanos\Billing\Gateways\ChargeInterface $charge |
|
| 40 | + * |
|
| 41 | + * @return void |
|
| 42 | + */ |
|
| 43 | + public function __construct(\Illuminate\Database\Eloquent\Model $model, \Mmanos\Billing\Gateways\ChargeInterface $charge) |
|
| 44 | + { |
|
| 45 | + $this->model = $model; |
|
| 46 | + $this->charge = $charge; |
|
| 47 | + $this->info = $charge->info(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Capture this charge in the billing gateway. |
|
| 52 | - * |
|
| 53 | - * @param array $properties |
|
| 54 | - * |
|
| 55 | - * @return Charge |
|
| 56 | - */ |
|
| 57 | - public function capture(array $properties = array()) |
|
| 58 | - { |
|
| 59 | - if (!$this->model->readyForBilling()) { |
|
| 60 | - return $this; |
|
| 61 | - } |
|
| 50 | + /** |
|
| 51 | + * Capture this charge in the billing gateway. |
|
| 52 | + * |
|
| 53 | + * @param array $properties |
|
| 54 | + * |
|
| 55 | + * @return Charge |
|
| 56 | + */ |
|
| 57 | + public function capture(array $properties = array()) |
|
| 58 | + { |
|
| 59 | + if (!$this->model->readyForBilling()) { |
|
| 60 | + return $this; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - $this->charge->capture($properties); |
|
| 64 | - $this->info = $this->charge->info(); |
|
| 63 | + $this->charge->capture($properties); |
|
| 64 | + $this->info = $this->charge->info(); |
|
| 65 | 65 | |
| 66 | - return $this; |
|
| 67 | - } |
|
| 66 | + return $this; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Refund this charge in the billing gateway. |
|
| 71 | - * |
|
| 72 | - * @param array $properties |
|
| 73 | - * |
|
| 74 | - * @return Charge |
|
| 75 | - */ |
|
| 76 | - public function refund(array $properties = array()) |
|
| 77 | - { |
|
| 78 | - if (!$this->model->readyForBilling()) { |
|
| 79 | - return $this; |
|
| 80 | - } |
|
| 69 | + /** |
|
| 70 | + * Refund this charge in the billing gateway. |
|
| 71 | + * |
|
| 72 | + * @param array $properties |
|
| 73 | + * |
|
| 74 | + * @return Charge |
|
| 75 | + */ |
|
| 76 | + public function refund(array $properties = array()) |
|
| 77 | + { |
|
| 78 | + if (!$this->model->readyForBilling()) { |
|
| 79 | + return $this; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - $this->charge->refund($properties); |
|
| 83 | - $this->info = $this->charge->info(); |
|
| 82 | + $this->charge->refund($properties); |
|
| 83 | + $this->info = $this->charge->info(); |
|
| 84 | 84 | |
| 85 | - return $this; |
|
| 86 | - } |
|
| 85 | + return $this; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Return the invoice object associated with this charge. |
|
| 90 | - * |
|
| 91 | - * @return Invoice |
|
| 92 | - */ |
|
| 93 | - public function invoice() |
|
| 94 | - { |
|
| 95 | - if (empty($this->invoice_id)) { |
|
| 96 | - return null; |
|
| 97 | - } |
|
| 88 | + /** |
|
| 89 | + * Return the invoice object associated with this charge. |
|
| 90 | + * |
|
| 91 | + * @return Invoice |
|
| 92 | + */ |
|
| 93 | + public function invoice() |
|
| 94 | + { |
|
| 95 | + if (empty($this->invoice_id)) { |
|
| 96 | + return null; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - if (null !== $this->invoice) { |
|
| 100 | - return $this->invoice ? $this->invoice : null; |
|
| 101 | - } |
|
| 99 | + if (null !== $this->invoice) { |
|
| 100 | + return $this->invoice ? $this->invoice : null; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - $this->invoice = false; |
|
| 104 | - if ($invoice = $this->model->invoices()->find($this->invoice_id)) { |
|
| 105 | - $this->invoice = $invoice; |
|
| 106 | - } |
|
| 103 | + $this->invoice = false; |
|
| 104 | + if ($invoice = $this->model->invoices()->find($this->invoice_id)) { |
|
| 105 | + $this->invoice = $invoice; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - return $this->invoice ? $this->invoice : null; |
|
| 109 | - } |
|
| 108 | + return $this->invoice ? $this->invoice : null; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * Convert this instance to an array. |
|
| 113 | - * |
|
| 114 | - * @return array |
|
| 115 | - */ |
|
| 116 | - public function toArray() |
|
| 117 | - { |
|
| 118 | - return $this->info; |
|
| 119 | - } |
|
| 111 | + /** |
|
| 112 | + * Convert this instance to an array. |
|
| 113 | + * |
|
| 114 | + * @return array |
|
| 115 | + */ |
|
| 116 | + public function toArray() |
|
| 117 | + { |
|
| 118 | + return $this->info; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Dynamically check a values existence from the charge. |
|
| 123 | - * |
|
| 124 | - * @param string $key |
|
| 125 | - * |
|
| 126 | - * @return bool |
|
| 127 | - */ |
|
| 128 | - public function __isset($key) |
|
| 129 | - { |
|
| 130 | - return isset($this->info[$key]); |
|
| 131 | - } |
|
| 121 | + /** |
|
| 122 | + * Dynamically check a values existence from the charge. |
|
| 123 | + * |
|
| 124 | + * @param string $key |
|
| 125 | + * |
|
| 126 | + * @return bool |
|
| 127 | + */ |
|
| 128 | + public function __isset($key) |
|
| 129 | + { |
|
| 130 | + return isset($this->info[$key]); |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * Dynamically get values from the charge. |
|
| 135 | - * |
|
| 136 | - * @param string $key |
|
| 137 | - * |
|
| 138 | - * @return mixed |
|
| 139 | - */ |
|
| 140 | - public function __get($key) |
|
| 141 | - { |
|
| 142 | - return isset($this->info[$key]) ? $this->info[$key] : null; |
|
| 143 | - } |
|
| 133 | + /** |
|
| 134 | + * Dynamically get values from the charge. |
|
| 135 | + * |
|
| 136 | + * @param string $key |
|
| 137 | + * |
|
| 138 | + * @return mixed |
|
| 139 | + */ |
|
| 140 | + public function __get($key) |
|
| 141 | + { |
|
| 142 | + return isset($this->info[$key]) ? $this->info[$key] : null; |
|
| 143 | + } |
|
| 144 | 144 | } |
@@ -1,6 +1,5 @@ |
||
| 1 | 1 | <?php namespace Mmanos\Billing\CustomerBillableTrait; |
| 2 | 2 | |
| 3 | -use Illuminate\Support\Arr; |
|
| 4 | 3 | use Illuminate\Support\Facades\View; |
| 5 | 4 | |
| 6 | 5 | class Invoice |
@@ -5,116 +5,116 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Invoice |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Customer model. |
|
| 10 | - * |
|
| 11 | - * @var \Illuminate\Database\Eloquent\Model |
|
| 12 | - */ |
|
| 13 | - protected $model; |
|
| 8 | + /** |
|
| 9 | + * Customer model. |
|
| 10 | + * |
|
| 11 | + * @var \Illuminate\Database\Eloquent\Model |
|
| 12 | + */ |
|
| 13 | + protected $model; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Invoice gateway instance. |
|
| 17 | - * |
|
| 18 | - * @var \Mmanos\Billing\Gateways\InvoiceInterface |
|
| 19 | - */ |
|
| 20 | - protected $invoice; |
|
| 15 | + /** |
|
| 16 | + * Invoice gateway instance. |
|
| 17 | + * |
|
| 18 | + * @var \Mmanos\Billing\Gateways\InvoiceInterface |
|
| 19 | + */ |
|
| 20 | + protected $invoice; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Invoice info array. |
|
| 24 | - * |
|
| 25 | - * @var array |
|
| 26 | - */ |
|
| 27 | - protected $info; |
|
| 22 | + /** |
|
| 23 | + * Invoice info array. |
|
| 24 | + * |
|
| 25 | + * @var array |
|
| 26 | + */ |
|
| 27 | + protected $info; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Create a new CustomerBillableTrait Invoice instance. |
|
| 31 | - * |
|
| 32 | - * @param \Illuminate\Database\Eloquent\Model $model |
|
| 33 | - * @param \Mmanos\Billing\Gateways\InvoiceInterface $invoice |
|
| 34 | - * |
|
| 35 | - * @return void |
|
| 36 | - */ |
|
| 37 | - public function __construct(\Illuminate\Database\Eloquent\Model $model, \Mmanos\Billing\Gateways\InvoiceInterface $invoice) |
|
| 38 | - { |
|
| 39 | - $this->model = $model; |
|
| 40 | - $this->invoice = $invoice; |
|
| 41 | - $this->info = $invoice->info(); |
|
| 42 | - } |
|
| 29 | + /** |
|
| 30 | + * Create a new CustomerBillableTrait Invoice instance. |
|
| 31 | + * |
|
| 32 | + * @param \Illuminate\Database\Eloquent\Model $model |
|
| 33 | + * @param \Mmanos\Billing\Gateways\InvoiceInterface $invoice |
|
| 34 | + * |
|
| 35 | + * @return void |
|
| 36 | + */ |
|
| 37 | + public function __construct(\Illuminate\Database\Eloquent\Model $model, \Mmanos\Billing\Gateways\InvoiceInterface $invoice) |
|
| 38 | + { |
|
| 39 | + $this->model = $model; |
|
| 40 | + $this->invoice = $invoice; |
|
| 41 | + $this->info = $invoice->info(); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Return an array of line items for this invoice. |
|
| 46 | - * |
|
| 47 | - * @return array |
|
| 48 | - */ |
|
| 49 | - public function items() |
|
| 50 | - { |
|
| 51 | - $items = array(); |
|
| 44 | + /** |
|
| 45 | + * Return an array of line items for this invoice. |
|
| 46 | + * |
|
| 47 | + * @return array |
|
| 48 | + */ |
|
| 49 | + public function items() |
|
| 50 | + { |
|
| 51 | + $items = array(); |
|
| 52 | 52 | |
| 53 | - foreach ($this->items as $item) { |
|
| 54 | - $items[] = new InvoiceItem($this->model, $this->invoice, $item); |
|
| 55 | - } |
|
| 53 | + foreach ($this->items as $item) { |
|
| 54 | + $items[] = new InvoiceItem($this->model, $this->invoice, $item); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - return $items; |
|
| 58 | - } |
|
| 57 | + return $items; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Get the invoice view. |
|
| 62 | - * |
|
| 63 | - * @param array $data |
|
| 64 | - * |
|
| 65 | - * @return View |
|
| 66 | - */ |
|
| 67 | - public function view(array $data = array()) |
|
| 68 | - { |
|
| 69 | - return View::make( |
|
| 70 | - 'laravel-billing::invoice', |
|
| 71 | - array_merge($data, array('invoice' => $this)) |
|
| 72 | - ); |
|
| 73 | - } |
|
| 60 | + /** |
|
| 61 | + * Get the invoice view. |
|
| 62 | + * |
|
| 63 | + * @param array $data |
|
| 64 | + * |
|
| 65 | + * @return View |
|
| 66 | + */ |
|
| 67 | + public function view(array $data = array()) |
|
| 68 | + { |
|
| 69 | + return View::make( |
|
| 70 | + 'laravel-billing::invoice', |
|
| 71 | + array_merge($data, array('invoice' => $this)) |
|
| 72 | + ); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Get the rendered HTML content of the invoice view. |
|
| 77 | - * |
|
| 78 | - * @param array $data |
|
| 79 | - * |
|
| 80 | - * @return string |
|
| 81 | - */ |
|
| 82 | - public function render(array $data = array()) |
|
| 83 | - { |
|
| 84 | - return $this->view($data)->render(); |
|
| 85 | - } |
|
| 75 | + /** |
|
| 76 | + * Get the rendered HTML content of the invoice view. |
|
| 77 | + * |
|
| 78 | + * @param array $data |
|
| 79 | + * |
|
| 80 | + * @return string |
|
| 81 | + */ |
|
| 82 | + public function render(array $data = array()) |
|
| 83 | + { |
|
| 84 | + return $this->view($data)->render(); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Convert this instance to an array. |
|
| 89 | - * |
|
| 90 | - * @return array |
|
| 91 | - */ |
|
| 92 | - public function toArray() |
|
| 93 | - { |
|
| 94 | - return $this->info; |
|
| 95 | - } |
|
| 87 | + /** |
|
| 88 | + * Convert this instance to an array. |
|
| 89 | + * |
|
| 90 | + * @return array |
|
| 91 | + */ |
|
| 92 | + public function toArray() |
|
| 93 | + { |
|
| 94 | + return $this->info; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Dynamically check a values existence from the invoice. |
|
| 99 | - * |
|
| 100 | - * @param string $key |
|
| 101 | - * |
|
| 102 | - * @return bool |
|
| 103 | - */ |
|
| 104 | - public function __isset($key) |
|
| 105 | - { |
|
| 106 | - return isset($this->info[$key]); |
|
| 107 | - } |
|
| 97 | + /** |
|
| 98 | + * Dynamically check a values existence from the invoice. |
|
| 99 | + * |
|
| 100 | + * @param string $key |
|
| 101 | + * |
|
| 102 | + * @return bool |
|
| 103 | + */ |
|
| 104 | + public function __isset($key) |
|
| 105 | + { |
|
| 106 | + return isset($this->info[$key]); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Dynamically get values from the invoice. |
|
| 111 | - * |
|
| 112 | - * @param string $key |
|
| 113 | - * |
|
| 114 | - * @return mixed |
|
| 115 | - */ |
|
| 116 | - public function __get($key) |
|
| 117 | - { |
|
| 118 | - return isset($this->info[$key]) ? $this->info[$key] : null; |
|
| 119 | - } |
|
| 109 | + /** |
|
| 110 | + * Dynamically get values from the invoice. |
|
| 111 | + * |
|
| 112 | + * @param string $key |
|
| 113 | + * |
|
| 114 | + * @return mixed |
|
| 115 | + */ |
|
| 116 | + public function __get($key) |
|
| 117 | + { |
|
| 118 | + return isset($this->info[$key]) ? $this->info[$key] : null; |
|
| 119 | + } |
|
| 120 | 120 | } |
@@ -1,7 +1,5 @@ |
||
| 1 | 1 | <?php namespace Mmanos\Billing\CustomerBillableTrait; |
| 2 | 2 | |
| 3 | -use Illuminate\Support\Arr; |
|
| 4 | - |
|
| 5 | 3 | class InvoiceItem |
| 6 | 4 | { |
| 7 | 5 | /** |
@@ -4,104 +4,104 @@ |
||
| 4 | 4 | |
| 5 | 5 | class InvoiceItem |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Customer model. |
|
| 9 | - * |
|
| 10 | - * @var \Illuminate\Database\Eloquent\Model |
|
| 11 | - */ |
|
| 12 | - protected $model; |
|
| 7 | + /** |
|
| 8 | + * Customer model. |
|
| 9 | + * |
|
| 10 | + * @var \Illuminate\Database\Eloquent\Model |
|
| 11 | + */ |
|
| 12 | + protected $model; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Invoice gateway instance. |
|
| 16 | - * |
|
| 17 | - * @var \Mmanos\Billing\Gateways\InvoiceInterface |
|
| 18 | - */ |
|
| 19 | - protected $invoice; |
|
| 14 | + /** |
|
| 15 | + * Invoice gateway instance. |
|
| 16 | + * |
|
| 17 | + * @var \Mmanos\Billing\Gateways\InvoiceInterface |
|
| 18 | + */ |
|
| 19 | + protected $invoice; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Invoice item info array. |
|
| 23 | - * |
|
| 24 | - * @var array |
|
| 25 | - */ |
|
| 26 | - protected $info; |
|
| 21 | + /** |
|
| 22 | + * Invoice item info array. |
|
| 23 | + * |
|
| 24 | + * @var array |
|
| 25 | + */ |
|
| 26 | + protected $info; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Local copy of the subscription model for this invoice item. |
|
| 30 | - * |
|
| 31 | - * @var \Illuminate\Database\Eloquent\Model |
|
| 32 | - */ |
|
| 33 | - protected $subscription; |
|
| 28 | + /** |
|
| 29 | + * Local copy of the subscription model for this invoice item. |
|
| 30 | + * |
|
| 31 | + * @var \Illuminate\Database\Eloquent\Model |
|
| 32 | + */ |
|
| 33 | + protected $subscription; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Create a new CustomerBillableTrait Invoice Item instance. |
|
| 37 | - * |
|
| 38 | - * @param \Illuminate\Database\Eloquent\Model $model |
|
| 39 | - * @param \Mmanos\Billing\Gateways\InvoiceInterface $invoice |
|
| 40 | - * @param array $item |
|
| 41 | - * |
|
| 42 | - * @return void |
|
| 43 | - */ |
|
| 44 | - public function __construct(\Illuminate\Database\Eloquent\Model $model, \Mmanos\Billing\Gateways\InvoiceInterface$invoice, array $item) |
|
| 45 | - { |
|
| 46 | - $this->model = $model; |
|
| 47 | - $this->invoice = $invoice; |
|
| 48 | - $this->info = $item; |
|
| 49 | - } |
|
| 35 | + /** |
|
| 36 | + * Create a new CustomerBillableTrait Invoice Item instance. |
|
| 37 | + * |
|
| 38 | + * @param \Illuminate\Database\Eloquent\Model $model |
|
| 39 | + * @param \Mmanos\Billing\Gateways\InvoiceInterface $invoice |
|
| 40 | + * @param array $item |
|
| 41 | + * |
|
| 42 | + * @return void |
|
| 43 | + */ |
|
| 44 | + public function __construct(\Illuminate\Database\Eloquent\Model $model, \Mmanos\Billing\Gateways\InvoiceInterface$invoice, array $item) |
|
| 45 | + { |
|
| 46 | + $this->model = $model; |
|
| 47 | + $this->invoice = $invoice; |
|
| 48 | + $this->info = $item; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Return the subscription helper object associated with this invoice item. |
|
| 53 | - * |
|
| 54 | - * @return \Mmanos\Billing\SubscriptionBillableTrait\Subscription |
|
| 55 | - */ |
|
| 56 | - public function subscription() |
|
| 57 | - { |
|
| 58 | - if (empty($this->subscription_id)) { |
|
| 59 | - return null; |
|
| 60 | - } |
|
| 51 | + /** |
|
| 52 | + * Return the subscription helper object associated with this invoice item. |
|
| 53 | + * |
|
| 54 | + * @return \Mmanos\Billing\SubscriptionBillableTrait\Subscription |
|
| 55 | + */ |
|
| 56 | + public function subscription() |
|
| 57 | + { |
|
| 58 | + if (empty($this->subscription_id)) { |
|
| 59 | + return null; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - if (null !== $this->subscription) { |
|
| 63 | - return $this->subscription ? $this->subscription : null; |
|
| 64 | - } |
|
| 62 | + if (null !== $this->subscription) { |
|
| 63 | + return $this->subscription ? $this->subscription : null; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - $this->subscription = false; |
|
| 67 | - if ($subscription = $this->model->subscriptions()->find($this->subscription_id)) { |
|
| 68 | - $this->subscription = $subscription; |
|
| 69 | - } |
|
| 66 | + $this->subscription = false; |
|
| 67 | + if ($subscription = $this->model->subscriptions()->find($this->subscription_id)) { |
|
| 68 | + $this->subscription = $subscription; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - return $this->subscription ? $this->subscription : null; |
|
| 72 | - } |
|
| 71 | + return $this->subscription ? $this->subscription : null; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Convert this instance to an array. |
|
| 76 | - * |
|
| 77 | - * @return array |
|
| 78 | - */ |
|
| 79 | - public function toArray() |
|
| 80 | - { |
|
| 81 | - return $this->info; |
|
| 82 | - } |
|
| 74 | + /** |
|
| 75 | + * Convert this instance to an array. |
|
| 76 | + * |
|
| 77 | + * @return array |
|
| 78 | + */ |
|
| 79 | + public function toArray() |
|
| 80 | + { |
|
| 81 | + return $this->info; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Dynamically check a values existence from the invoice. |
|
| 86 | - * |
|
| 87 | - * @param string $key |
|
| 88 | - * |
|
| 89 | - * @return bool |
|
| 90 | - */ |
|
| 91 | - public function __isset($key) |
|
| 92 | - { |
|
| 93 | - return isset($this->info[$key]); |
|
| 94 | - } |
|
| 84 | + /** |
|
| 85 | + * Dynamically check a values existence from the invoice. |
|
| 86 | + * |
|
| 87 | + * @param string $key |
|
| 88 | + * |
|
| 89 | + * @return bool |
|
| 90 | + */ |
|
| 91 | + public function __isset($key) |
|
| 92 | + { |
|
| 93 | + return isset($this->info[$key]); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Dynamically get values from the invoice. |
|
| 98 | - * |
|
| 99 | - * @param string $key |
|
| 100 | - * |
|
| 101 | - * @return mixed |
|
| 102 | - */ |
|
| 103 | - public function __get($key) |
|
| 104 | - { |
|
| 105 | - return isset($this->info[$key]) ? $this->info[$key] : null; |
|
| 106 | - } |
|
| 96 | + /** |
|
| 97 | + * Dynamically get values from the invoice. |
|
| 98 | + * |
|
| 99 | + * @param string $key |
|
| 100 | + * |
|
| 101 | + * @return mixed |
|
| 102 | + */ |
|
| 103 | + public function __get($key) |
|
| 104 | + { |
|
| 105 | + return isset($this->info[$key]) ? $this->info[$key] : null; |
|
| 106 | + } |
|
| 107 | 107 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | /** |
| 8 | 8 | * Find a billing customer implementation by billing ID. |
| 9 | 9 | * |
| 10 | - * @param mixed $billing_id |
|
| 10 | + * @param string $billing_id |
|
| 11 | 11 | * |
| 12 | 12 | * @return \Illuminate\Database\Eloquent\Model |
| 13 | 13 | */ |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * Find a billing subscription implementation by subscription ID. |
| 33 | 33 | * |
| 34 | - * @param mixed $subscription_id |
|
| 34 | + * @param string $subscription_id |
|
| 35 | 35 | * |
| 36 | 36 | * @return \Illuminate\Database\Eloquent\Model |
| 37 | 37 | */ |
@@ -4,51 +4,51 @@ |
||
| 4 | 4 | |
| 5 | 5 | class EloquentBillableRepository |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Find a billing customer implementation by billing ID. |
|
| 9 | - * |
|
| 10 | - * @param mixed $billing_id |
|
| 11 | - * |
|
| 12 | - * @return \Illuminate\Database\Eloquent\Model |
|
| 13 | - */ |
|
| 14 | - public static function findCustomer($billing_id) |
|
| 15 | - { |
|
| 16 | - if (!$billing_id) { |
|
| 17 | - return null; |
|
| 18 | - } |
|
| 7 | + /** |
|
| 8 | + * Find a billing customer implementation by billing ID. |
|
| 9 | + * |
|
| 10 | + * @param mixed $billing_id |
|
| 11 | + * |
|
| 12 | + * @return \Illuminate\Database\Eloquent\Model |
|
| 13 | + */ |
|
| 14 | + public static function findCustomer($billing_id) |
|
| 15 | + { |
|
| 16 | + if (!$billing_id) { |
|
| 17 | + return null; |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - foreach (Config::get('laravel-billing::customer_models') as $model) { |
|
| 21 | - $query = new $model; |
|
| 20 | + foreach (Config::get('laravel-billing::customer_models') as $model) { |
|
| 21 | + $query = new $model; |
|
| 22 | 22 | |
| 23 | - if ($customer = $query->where('billing_id', $billing_id)->first()) { |
|
| 24 | - return $customer; |
|
| 25 | - } |
|
| 26 | - } |
|
| 23 | + if ($customer = $query->where('billing_id', $billing_id)->first()) { |
|
| 24 | + return $customer; |
|
| 25 | + } |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - return null; |
|
| 29 | - } |
|
| 28 | + return null; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Find a billing subscription implementation by subscription ID. |
|
| 33 | - * |
|
| 34 | - * @param mixed $subscription_id |
|
| 35 | - * |
|
| 36 | - * @return \Illuminate\Database\Eloquent\Model |
|
| 37 | - */ |
|
| 38 | - public static function findSubscription($subscription_id) |
|
| 39 | - { |
|
| 40 | - if (!$subscription_id) { |
|
| 41 | - return null; |
|
| 42 | - } |
|
| 31 | + /** |
|
| 32 | + * Find a billing subscription implementation by subscription ID. |
|
| 33 | + * |
|
| 34 | + * @param mixed $subscription_id |
|
| 35 | + * |
|
| 36 | + * @return \Illuminate\Database\Eloquent\Model |
|
| 37 | + */ |
|
| 38 | + public static function findSubscription($subscription_id) |
|
| 39 | + { |
|
| 40 | + if (!$subscription_id) { |
|
| 41 | + return null; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - foreach (Config::get('laravel-billing::subscription_models') as $model) { |
|
| 45 | - $query = new $model; |
|
| 44 | + foreach (Config::get('laravel-billing::subscription_models') as $model) { |
|
| 45 | + $query = new $model; |
|
| 46 | 46 | |
| 47 | - if ($subscription = $query->where('billing_subscription', $subscription_id)->first()) { |
|
| 48 | - return $subscription; |
|
| 49 | - } |
|
| 50 | - } |
|
| 47 | + if ($subscription = $query->where('billing_subscription', $subscription_id)->first()) { |
|
| 48 | + return $subscription; |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - return null; |
|
| 53 | - } |
|
| 52 | + return null; |
|
| 53 | + } |
|
| 54 | 54 | } |