1 | <?php |
||||||
2 | |||||||
3 | namespace ByTIC\Payments\Models\Subscriptions; |
||||||
4 | |||||||
5 | use ByTIC\DataObjects\Behaviors\Timestampable\TimestampableTrait; |
||||||
6 | use ByTIC\DataObjects\Casts\Metadata\AsMetadataObject; |
||||||
7 | use ByTIC\Models\SmartProperties\Properties\AbstractProperty\Generic; |
||||||
8 | use ByTIC\Models\SmartProperties\RecordsTraits\HasStatus\RecordTrait; |
||||||
9 | use ByTIC\Payments\Models\AbstractModels\HasCustomer\HasCustomerRecord; |
||||||
10 | use ByTIC\Payments\Models\AbstractModels\HasPaymentMethod\HasPaymentMethodRecord; |
||||||
11 | use ByTIC\Payments\Models\AbstractModels\HasPaymentMethod\HasPaymentMethodRecordTrait; |
||||||
0 ignored issues
–
show
|
|||||||
12 | use ByTIC\Payments\Models\AbstractModels\HasToken\HasTokenRecord; |
||||||
13 | use ByTIC\Payments\Models\Tokens\Token; |
||||||
14 | use ByTIC\Payments\Models\Transactions\Transaction; |
||||||
15 | use ByTIC\Payments\Models\Transactions\TransactionTrait; |
||||||
16 | use ByTIC\Payments\Subscriptions\ChargeMethods\AbstractMethod; |
||||||
17 | use DateTime; |
||||||
18 | use Paytic\Omnipay\Common\Models\SubscriptionInterface; |
||||||
0 ignored issues
–
show
The type
Paytic\Omnipay\Common\Models\SubscriptionInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
19 | |||||||
20 | /** |
||||||
21 | * Trait SubscriptionTrait |
||||||
22 | * @package ByTIC\Payments\Models\Subscriptions |
||||||
23 | * |
||||||
24 | * @property int $id_method |
||||||
25 | * @property int $id_token |
||||||
26 | * @property int $id_last_transaction |
||||||
27 | * @property int $id_billing_record |
||||||
28 | * |
||||||
29 | * @property string $billing_period |
||||||
30 | * @property int $billing_interval |
||||||
31 | * @property int $billing_count |
||||||
32 | * |
||||||
33 | * @property string|DateTime $start_at |
||||||
34 | * @property string|DateTime $cancel_at |
||||||
35 | * @property string|DateTime $ended_at |
||||||
36 | * @property string|DateTime $charge_at |
||||||
37 | * |
||||||
38 | * @property int $charge_attempts |
||||||
39 | * @property int $charge_count |
||||||
40 | * @property int $charge_method |
||||||
41 | * |
||||||
42 | * @property string $modified |
||||||
43 | * @property string $created |
||||||
44 | * |
||||||
45 | * @method Transaction getLastTransaction |
||||||
46 | * @method SubscriptionsTrait getManager |
||||||
47 | */ |
||||||
48 | trait SubscriptionTrait |
||||||
49 | { |
||||||
50 | use RecordTrait; |
||||||
51 | use HasPaymentMethodRecord; |
||||||
52 | use HasCustomerRecord; |
||||||
53 | use HasTokenRecord; |
||||||
54 | use TimestampableTrait; |
||||||
55 | |||||||
56 | public function getName() |
||||||
57 | { |
||||||
58 | return $this->getManager()->getLabel('title.singular') . ' #' . $this->id; |
||||||
0 ignored issues
–
show
The method
getLabel() does not exist on ByTIC\Payments\Models\Su...ions\SubscriptionsTrait . Did you maybe mean getTable() ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
59 | } |
||||||
60 | |||||||
61 | /** |
||||||
62 | * @var string |
||||||
63 | */ |
||||||
64 | protected static $createTimestamps = ['created']; |
||||||
65 | |||||||
66 | /** |
||||||
67 | * @var string |
||||||
68 | */ |
||||||
69 | protected static $updateTimestamps = ['modified']; |
||||||
70 | |||||||
71 | public function bootSubscriptionTrait() |
||||||
72 | { |
||||||
73 | $fields = [ |
||||||
74 | 'start_at' => 'date', |
||||||
75 | 'cancel_at' => 'date', |
||||||
76 | 'ended_at' => 'date', |
||||||
77 | 'charge_at' => 'datetime' |
||||||
78 | ]; |
||||||
79 | foreach ($fields as $field => $cast) { |
||||||
80 | if ($this->hasCast($field)) { |
||||||
0 ignored issues
–
show
It seems like
hasCast() 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
![]() |
|||||||
81 | continue; |
||||||
82 | } |
||||||
83 | $this->addCast($field, $cast); |
||||||
0 ignored issues
–
show
It seems like
addCast() 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
![]() |
|||||||
84 | } |
||||||
85 | $this->addCast('metadata', AsMetadataObject::class . ':json'); |
||||||
86 | } |
||||||
87 | |||||||
88 | /** |
||||||
89 | * @param $key |
||||||
90 | * @param $value |
||||||
91 | */ |
||||||
92 | public function addMedata($key, $value) |
||||||
93 | { |
||||||
94 | $this->metadata->set($key, $value); |
||||||
95 | } |
||||||
96 | |||||||
97 | /** |
||||||
98 | * @return Generic|AbstractMethod |
||||||
99 | */ |
||||||
100 | public function getChargeMethod() |
||||||
101 | { |
||||||
102 | return $this->getSmartProperty('ChargeMethods'); |
||||||
103 | } |
||||||
104 | |||||||
105 | /** |
||||||
106 | * @param Transaction|TransactionTrait $transaction |
||||||
107 | */ |
||||||
108 | public function populateFromLastTransaction($transaction) |
||||||
109 | { |
||||||
110 | $this->id_last_transaction = $transaction->id; |
||||||
111 | $this->getRelation('LastTransaction')->setResults($transaction); |
||||||
0 ignored issues
–
show
It seems like
getRelation() 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
![]() |
|||||||
112 | } |
||||||
113 | |||||||
114 | /** |
||||||
115 | * @param Token $token |
||||||
116 | */ |
||||||
117 | public function populateFromToken($token) |
||||||
118 | { |
||||||
119 | $this->id_token = $token->id; |
||||||
120 | $this->getRelation('Token')->setResults($token); |
||||||
121 | } |
||||||
122 | } |
||||||
123 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths