/**
  * throws exceptions if $item is not a valid readable container
  *
  * @param  mixed $item
  *         the item to check
  * @param  string $eUnsupportedType
  *         the class to use when throwing an unsupported-type exception
  * @return void
  */
 public static function check($item, $eUnsupportedType = E4xx_UnsupportedType::class)
 {
     // make sure we have a valid container
     if (!IsReadableContainer::check($item)) {
         throw new $eUnsupportedType($item);
     }
 }
 /**
  * @covers ::check
  * @dataProvider provideScalars
  */
 public function testReportsScalarsAsNotReadableContainers($data)
 {
     // ----------------------------------------------------------------
     // setup your test
     // ----------------------------------------------------------------
     // perform the change
     $actualResult = IsReadableContainer::check($data);
     // ----------------------------------------------------------------
     // test the results
     $this->assertFalse($actualResult);
 }
 /**
  * get whatever is at the end of the given dot.notation.support path,
  * optionally extending the path as required
  *
  * @param  array|object &$root
  *         where we start from
  * @param  string $path
  *         the dot.notation.support path to descend
  * @param  array|callable|string|null $extendingItem
  *         if we need to extend, what data type do we extend using?
  * @return mixed
  */
 private static function &getPathFromRoot(&$root, $path, $extendingItem)
 {
     // to avoid recursion, this will track where we are in the tree
     $retval =& $root;
     // this will track where we have been, in case we need to report on
     // an error
     $visitedPath = [];
     // explore the path
     $parts = explode(".", $path);
     foreach ($parts as $part) {
         // make sure we have a valid container
         if (!IsReadableContainer::check($retval)) {
             throw new E4xx_CannotDescendPath($retval, implode('.', $visitedPath));
         }
         $retval =& self::getChildFromPart($retval, $part, $extendingItem);
         $visitedPath[] = $part;
     }
     // if we get here, then we have found what they are looking for
     return $retval;
 }