/** * does $path point to a valid piece of data inside $container? * * @param mixed $container * the container to look inside * @param string $path * the dot.notation.support path to walk * @return boolean * TRUE if $path points to a vlaid piece of data * FALSE otherwise */ public static function in($container, $path) { RequireReadableContainer::check($container); $method = self::lookupMethodFor($container, self::$dispatchTable); return self::$method($container, $path); }
/** * @covers ::check * @dataProvider provideNonReadableContainers * @expectedException GanbaroDigital\DataContainers\Exceptions\E4xx_UnsupportedType */ public function testRejectsNonReadableContainersWhenCalledStatically($item) { // ---------------------------------------------------------------- // setup your test // ---------------------------------------------------------------- // perform the change RequireReadableContainer::check($item); }
/** * extract a value from a container, using dot.notation.support * * @param mixed $item * the container to extract from * @param string $path * the dot.notation.support path to walk * @return mixed * whatever we find when we walk the path */ public static function from($item, $path) { // robustness! RequireReadableContainer::check($item, E4xx_UnsupportedType::class); if (IsAssignable::check($item)) { return self::fromObject($item, $path); } return self::fromArray($item, $path); }