data_set

The data_set function sets a value within a nested array or object using "dot" notation:
<?php $data = ['products' => ['desk' => ['price' => 100]]];

data_set($data, 'products.desk.price', 200);
<?php         foreach ($values as $key => $value) {

            if (in_array(Utils::beforeFirstDot($key), $publicProperties)) {

                data_set($this, $key, $value);

            }

        }

    }
<?php                 continue;

            }



            data_set($this, $property, data_get($freshInstance, $property));

        }

    }
<?php             $value = $enum::from($value);

        }



        data_set($this->component, $this->levelName, $value);

    }



    protected function tryingToSetStringOrIntegerToEnum($subject)
<?php         foreach ($values as $key => $value) {

            if (in_array(Utils::beforeFirstDot($key), $publicProperties)) {

                data_set($this, $key, $value);

            }

        }

    }
<?php         $freshInstance = new static($this->getComponent(), $this->getPropertyName());



        foreach ($properties as $property) {

            data_set($this, $property, data_get($freshInstance, $property));

        }

    }
<?php                     $data = [];

                }



                data_set($data, $fieldKey, $this->filterCollectionDataDownToSpecificKeys($keyData, $ruleKeys, $fieldKeys));

            }

        }
<?php     function data_fill(&$target, $key, $value)

    {

        return data_set($target, $key, $value, false);

    }

}
<?php             if ($segments) {

                foreach ($target as &$inner) {

                    data_set($inner, $segments, $value, $overwrite);

                }

            } elseif ($overwrite) {

                foreach ($target as &$inner) {
<?php                     $target[$segment] = [];

                }



                data_set($target[$segment], $segments, $value, $overwrite);

            } elseif ($overwrite || ! Arr::exists($target, $segment)) {

                $target[$segment] = $value;

            }
<?php                     $target->{$segment} = [];

                }



                data_set($target->{$segment}, $segments, $value, $overwrite);

            } elseif ($overwrite || ! isset($target->{$segment})) {

                $target->{$segment} = $value;

            }
<?php             $target = [];



            if ($segments) {

                data_set($target[$segment], $segments, $value, $overwrite);

            } elseif ($overwrite) {

                $target[$segment] = $value;

            }
<?php             return $data;

        }



        return data_set($data, $attribute, null, true);

    }
<?php         $this->assertEquals(

            ['foo' => 'bar', 'baz' => 'boom'],

            data_set($data, 'baz', 'boom')

        );



        $this->assertEquals(
<?php         $this->assertEquals(

            ['foo' => 'bar', 'baz' => 'kaboom'],

            data_set($data, 'baz', 'kaboom')

        );



        $this->assertEquals(
<?php         $this->assertEquals(

            ['foo' => [], 'baz' => 'kaboom'],

            data_set($data, 'foo.*', 'noop')

        );



        $this->assertEquals(