1 | <?php |
||
38 | class CartItem extends Model |
||
39 | { |
||
40 | /** |
||
41 | * The attributes that aren't mass assignable. |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $guarded = ['id']; |
||
46 | |||
47 | /** |
||
48 | * The attributes that should be cast to native types. |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $casts = ['options' => 'array']; |
||
53 | |||
54 | /** |
||
55 | * The unique, option specific identifier for this cart item. |
||
56 | * |
||
57 | * @var string |
||
58 | */ |
||
59 | protected $identifier; |
||
60 | |||
61 | /** |
||
62 | * The buyable instance. |
||
63 | * |
||
64 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
65 | */ |
||
66 | public function buyable() |
||
70 | |||
71 | /** |
||
72 | * Create a new collection instance. |
||
73 | * |
||
74 | * @param array $models |
||
75 | * @return \Treestoneit\ShoppingCart\Models\CartItemCollection |
||
76 | */ |
||
77 | public function newCollection(array $models = []) |
||
81 | |||
82 | /** |
||
83 | * Get the name of the item. |
||
84 | */ |
||
85 | public function getDescriptionAttribute() |
||
89 | |||
90 | /** |
||
91 | * Get the base price of the item. |
||
92 | * |
||
93 | * @return float|null |
||
94 | */ |
||
95 | public function getPriceAttribute() |
||
99 | |||
100 | /** |
||
101 | * Get the price * quantity. |
||
102 | * |
||
103 | * @return float |
||
104 | */ |
||
105 | public function getSubtotalAttribute() |
||
112 | |||
113 | /** |
||
114 | * Get the extra fees for this product. |
||
115 | * |
||
116 | * @return float|int |
||
117 | */ |
||
118 | public function getExtraFeesAttribute() |
||
122 | |||
123 | /** |
||
124 | * Get the total for this item. |
||
125 | * |
||
126 | * @return float |
||
127 | */ |
||
128 | public function getTotalAttribute() |
||
135 | |||
136 | /** |
||
137 | * Get the unique identifier for this cart item. |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getIdentifierAttribute(): string |
||
149 | |||
150 | /** |
||
151 | * Add options to this cart item. |
||
152 | * |
||
153 | * @param array $options |
||
154 | */ |
||
155 | public function setOptionsAttribute(array $options) |
||
162 | |||
163 | /** |
||
164 | * Make sure that only the enumerated option values for this buyable are present in the options array. |
||
165 | * |
||
166 | * @param array $options |
||
167 | * @return array |
||
168 | */ |
||
169 | protected function validateOptions(array $options): array |
||
181 | |||
182 | /** |
||
183 | * Create a unique identifier for this cart item. |
||
184 | * |
||
185 | * @return string |
||
186 | */ |
||
187 | protected function makeIdentifier(): string |
||
191 | } |
||
192 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.