/** * merge data from a container, using dot.notation.support to identify * the data to remove * * @param mixed $container * the container we want to remove from * @param string $path * the dot.notation.support path to the data to remove * @return void */ public static function from(&$container, $path) { // defensive programming! RequireAnyOneOf::check([new IsAssignable(), new IsIndexable()], [$container], E4xx_UnsupportedType::class); RequireDotNotationPath::check($path); // find the point where we want to remove the data from list($firstPart, $finalPart) = self::splitPathInTwo($path); $leaf =& DescendDotNotationPath::into($container, $firstPart); // remove it RemoveProperty::from($leaf, $finalPart); }
/** * @covers ::from * @dataProvider provideContainersToTest */ public function testCanCallStatically($container, $propertyName, $expectedResult) { // ---------------------------------------------------------------- // setup your test // ---------------------------------------------------------------- // perform the change RemoveProperty::from($container, $propertyName); // ---------------------------------------------------------------- // test the results $this->assertEquals($expectedResult, $container); }