Skip to content

Commit be70e74

Browse files
committed
refactor: rename parameter name to $object
1 parent 285f379 commit be70e74

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

system/BaseModel.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,17 +1659,17 @@ public function asObject(string $class = 'object')
16591659
* This method uses objectToRawArray() internally and does conversion
16601660
* to string on all Time instances
16611661
*
1662-
* @param object|null $data Data
1662+
* @param object|null $object Object
16631663
* @param bool $onlyChanged Only Changed Property
16641664
* @param bool $recursive If true, inner entities will be cast as array as well
16651665
*
16661666
* @return array Array
16671667
*
16681668
* @throws ReflectionException
16691669
*/
1670-
protected function objectToArray($data, bool $onlyChanged = true, bool $recursive = false): array
1670+
protected function objectToArray($object, bool $onlyChanged = true, bool $recursive = false): array
16711671
{
1672-
$properties = $this->objectToRawArray($data, $onlyChanged, $recursive);
1672+
$properties = $this->objectToRawArray($object, $onlyChanged, $recursive);
16731673

16741674
assert(is_array($properties));
16751675

@@ -1691,20 +1691,20 @@ protected function objectToArray($data, bool $onlyChanged = true, bool $recursiv
16911691
* Takes a class and returns an array of its public and protected
16921692
* properties as an array with raw values.
16931693
*
1694-
* @param object|null $data Data
1694+
* @param object|null $object Object
16951695
* @param bool $onlyChanged Only Changed Property
16961696
* @param bool $recursive If true, inner entities will be casted as array as well
16971697
*
16981698
* @return array|null Array
16991699
*
17001700
* @throws ReflectionException
17011701
*/
1702-
protected function objectToRawArray($data, bool $onlyChanged = true, bool $recursive = false): ?array
1702+
protected function objectToRawArray($object, bool $onlyChanged = true, bool $recursive = false): array
17031703
{
1704-
if (method_exists($data, 'toRawArray')) {
1705-
$properties = $data->toRawArray($onlyChanged, $recursive);
1704+
if (method_exists($object, 'toRawArray')) {
1705+
$properties = $object->toRawArray($onlyChanged, $recursive);
17061706
} else {
1707-
$mirror = new ReflectionClass($data);
1707+
$mirror = new ReflectionClass($object);
17081708
$props = $mirror->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED);
17091709

17101710
$properties = [];
@@ -1714,7 +1714,7 @@ protected function objectToRawArray($data, bool $onlyChanged = true, bool $recur
17141714
foreach ($props as $prop) {
17151715
// Must make protected values accessible.
17161716
$prop->setAccessible(true);
1717-
$properties[$prop->getName()] = $prop->getValue($data);
1717+
$properties[$prop->getName()] = $prop->getValue($object);
17181718
}
17191719
}
17201720

system/Model.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,16 +803,16 @@ public function update($id = null, $data = null): bool
803803
* Takes a class and returns an array of its public and protected
804804
* properties as an array with raw values.
805805
*
806-
* @param object|null $data
806+
* @param object|null $object Object
807807
* @param bool $recursive If true, inner entities will be cast as array as well
808808
*
809809
* @return array|null Array
810810
*
811811
* @throws ReflectionException
812812
*/
813-
protected function objectToRawArray($data, bool $onlyChanged = true, bool $recursive = false): ?array
813+
protected function objectToRawArray($object, bool $onlyChanged = true, bool $recursive = false): array
814814
{
815-
return parent::objectToRawArray($data, $onlyChanged);
815+
return parent::objectToRawArray($object, $onlyChanged);
816816
}
817817

818818
/**

0 commit comments

Comments
 (0)