/** * @covers ::into * @dataProvider provideNonIndexableNorAssignable * @expectedException GanbaroDigital\DataContainers\Exceptions\E4xx_UnsupportedType */ public function testThrowsExceptionIfCalledStaticallyWithNonContainer($container) { // ---------------------------------------------------------------- // setup your test $path = 'one.two'; $theirs = []; // ---------------------------------------------------------------- // perform the change MergeUsingDotNotationPath::into($container, $path, $theirs); }
/** * magic method, called when there's an attempt to set a property that * doesn't actually exist * * if $propertyName is a dot.notation.support path, we'll attempt to * set the property using the path * * @param string $propertyName * name of the property to set * @param mixed $propertyValue * value of the property to set * @return void */ public function __set($propertyName, $propertyValue) { // is the user trying to use dot.notation? if (IsDotNotationPath::checkString($propertyName)) { return MergeUsingDotNotationPath::intoObject($this, $propertyName, $propertyValue, DataBag::class); } // if we get here, then we simply have a new property to set // // I hope that it does not recurse! $this->{$propertyName} = $propertyValue; }