コード例 #1
0
ファイル: ArrayProxy.php プロジェクト: marmotz/dumper
 /**
  * Constructor
  *
  * @param array $array
  * @param Dump  $dumper
  */
 public function __construct(array $array, Dump $dumper)
 {
     $this->setMaxKeyLength(0);
     $this->array = array();
     foreach ($array as $key => $value) {
         $dumpedKey = $dumper->getDump($key, null, Dump::FORMAT_SHORT);
         $this->array[$dumpedKey] = $value;
         $this->setIfMaxKeyLength(strlen($dumpedKey));
     }
     $this->keys = array_keys($this->array);
     $this->pointer = 0;
 }
コード例 #2
0
ファイル: Dump.php プロジェクト: marmotz/dumper
 public function testMaxLevelOfRecursion()
 {
     $this->if($level = rand(1, 10))->variable(TestedClass::setMaxLevelOfRecursion($level))->isNull()->integer(TestedClass::getMaxLevelOfRecursion())->isEqualTo($level)->boolean(TestedClass::isMaxLevelOfRecursion($level))->isFalse()->boolean(TestedClass::isMaxLevelOfRecursion($level + 1))->isTrue()->if($level = (string) rand(1, 10))->variable(TestedClass::setMaxLevelOfRecursion($level))->isNull()->integer(TestedClass::getMaxLevelOfRecursion())->isEqualTo((int) $level)->boolean(TestedClass::isMaxLevelOfRecursion($level))->isFalse()->boolean(TestedClass::isMaxLevelOfRecursion($level + 1))->isTrue()->if($level = -1)->variable(TestedClass::setMaxLevelOfRecursion($level))->isNull()->boolean(TestedClass::getMaxLevelOfRecursion())->isFalse()->boolean(TestedClass::isMaxLevelOfRecursion(rand(1, 100)))->isFalse()->if($level = false)->variable(TestedClass::setMaxLevelOfRecursion($level))->isNull()->boolean(TestedClass::getMaxLevelOfRecursion())->isFalse()->boolean(TestedClass::isMaxLevelOfRecursion(rand(1, 100)))->isFalse()->if($level = true)->variable(TestedClass::setMaxLevelOfRecursion($level))->isNull()->boolean(TestedClass::getMaxLevelOfRecursion())->isFalse()->boolean(TestedClass::isMaxLevelOfRecursion(rand(1, 100)))->isFalse()->if($level = __METHOD__)->variable(TestedClass::setMaxLevelOfRecursion($level))->isNull()->boolean(TestedClass::getMaxLevelOfRecursion())->isFalse()->boolean(TestedClass::isMaxLevelOfRecursion(rand(1, 100)))->isFalse();
 }