/** * {@inheritdoc} */ public function __construct(array $tree, NcursesVarDumpTypeAbstract $parent = null) { if ("string" != $tree["type"]) { throw new \InvalidArgumentException("Invalid var tree given, expected 'string'"); } parent::__construct($tree, $parent); $strExpanded = ""; $strCollapsed = ""; // build expanded string $strExpanded = "<<4>>string<<0>>(<<1>>{$tree["length"]}<<0>>) <<1>>\"{$tree["value"]}\"<<0>>"; // build collapsed string // limits string length if it is multiline $limit = strpos($tree["value"], "\n"); $limit = false !== $limit ? $limit : $tree["length"]; $string = $tree["value"]; if ($tree["length"] > $limit) { $string = substr($tree["value"], 0, $limit) . "..."; $strCollapsed = "<<4>>string<<0>>(<<1>>{$tree["length"]}<<0>>) <<1>>\"{$string}\"<<0>> ▸"; $this->setExpandable(true); $this->setStringArrayCollapsed($this->buildTextArray($strCollapsed)); $this->setStringArrayExpanded($this->buildTextArray($strExpanded)); } else { // non expandable string $this->setStringArrayCollapsed($this->buildTextArray($strExpanded)); } }
/** * {@inheritdoc} */ public function __construct(array $tree, NcursesVarDumpTypeAbstract $parent = null) { if ("bool" != $tree["type"] && "boolean" != $tree["type"]) { throw new \InvalidArgumentException("Invalid var tree given, expected one of 'bool' or 'boolean'"); } parent::__construct($tree, $parent); // build text array $str = "<<4>>bool<<0>>(<<2>>{$tree["value"]}<<0>>)"; $strArray = $this->buildTextArray($str); $this->setStringArrayCollapsed($strArray); }
/** * {@inheritdoc} */ public function __construct(array $tree, NcursesVarDumpTypeAbstract $parent = null) { if ("resource" != $tree["type"]) { throw new \InvalidArgumentException("Invalid var tree given, expected 'resource'"); } parent::__construct($tree, $parent); // build text array $str = "<<4>>resource<<0>>({$tree["value"]})"; $strArray = $this->buildTextArray($str); $this->setStringArrayCollapsed($strArray); }
/** * {@inheritdoc} */ public function __construct(array $tree, NcursesVarDumpTypeAbstract $parent = null) { if ("null" != $tree["type"] && "NULL" != $tree["type"]) { throw new \InvalidArgumentException("Invalid var tree given, expected 'null'"); } parent::__construct($tree, $parent); // build text array $str = "<<2>>null"; $strArray = $this->buildTextArray($str); $this->setStringArrayCollapsed($strArray); }
/** * {@inheritdoc} */ public function __construct(array $tree, NcursesVarDumpTypeAbstract $parent = null) { if ("integer" != $tree["type"] && "long" != $tree["type"] && "float" != $tree["type"] && "double" != $tree["type"]) { throw new \InvalidArgumentException("Invalid var tree given, expected one of 'integer', 'long', 'float', 'double"); } parent::__construct($tree, $parent); // build text array $str = "<<4>>{$tree["type"]}<<0>>(<<1>>{$tree["value"]}<<0>>)"; $strArray = $this->buildTextArray($str); $this->setStringArrayCollapsed($strArray); }
/** * {@inheritdoc} */ public function clearSearch() { $this->clearCaches(); parent::clearSearch(); }
/** * {@inheritdoc} */ public function getStringArrayExpanded() { return $this->highlightReference(parent::getStringArrayExpanded()); }