当前位置: 首页>>代码示例>>PHP>>正文


PHP Debug::export方法代码示例

本文整理汇总了PHP中Doctrine\Common\Util\Debug::export方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::export方法的具体用法?PHP Debug::export怎么用?PHP Debug::export使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\Common\Util\Debug的用法示例。


在下文中一共展示了Debug::export方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dump

 public static function dump($entity, $maxDepth = 1, $toHtml = true)
 {
     $output = print_r(Debug::export($entity, $maxDepth), true);
     if ($toHtml) {
         echo "<pre>{$output}</pre>";
     } else {
         echo $output;
     }
 }
开发者ID:acplo,项目名称:acplolog,代码行数:9,代码来源:EntityLogger.php

示例2: testExportArrayTraversable

 public function testExportArrayTraversable()
 {
     $obj = new \ArrayObject(array('foobar'));
     $var = Debug::export($obj, 2);
     $this->assertContains('foobar', $var->__STORAGE__);
     $it = new \ArrayIterator(array('foobar'));
     $var = Debug::export($it, 5);
     $this->assertContains('foobar', $var->__STORAGE__);
 }
开发者ID:sanborino,项目名称:clinica,代码行数:9,代码来源:DebugTest.php

示例3: export

 /**
  * {@inheritdoc}
  */
 public function export($input, $name = NULL)
 {
     $name = $name ? $name . ' => ' : '';
     $variable = Debug::export($input, 6);
     ob_start();
     print_r($variable);
     $dump = ob_get_contents();
     ob_end_clean();
     $dump = '<pre>' . $name . $dump . '</pre>';
     return $this->setSafeMarkup($dump);
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:14,代码来源:DoctrineDebug.php

示例4: eligibleAttributesAsLabelShouldBe

 /**
  * @param string $attributes
  *
  * @Then /^eligible attributes as label should be (.*)$/
  *
  * @throws ExpectationException
  */
 public function eligibleAttributesAsLabelShouldBe($attributes)
 {
     $expectedAttributes = $this->listToArray($attributes);
     $options = $this->getPage('Family edit')->getAttributeAsLabelOptions();
     if (count($expectedAttributes) !== ($actual = count($options))) {
         throw $this->createExpectationException(sprintf('Expected to see %d eligible attributes as label, actually saw %d:' . "\n%s", count($expectedAttributes), $actual, print_r(\Doctrine\Common\Util\Debug::export($options, 2), true)));
     }
     if ($expectedAttributes !== $options) {
         throw $this->createExpectationException(sprintf('Expected to see eligible attributes as label %s, actually saw %s', print_r(\Doctrine\Common\Util\Debug::export($expectedAttributes, 2), true), print_r(\Doctrine\Common\Util\Debug::export($options, 2), true)));
     }
 }
开发者ID:qrz-io,项目名称:pim-community-dev,代码行数:18,代码来源:WebUser.php

示例5: _escapeDoctrineDump

 private static function _escapeDoctrineDump(&$val)
 {
     if ($val instanceof \Cx\Model\Base\EntityBase) {
         $val = \Doctrine\Common\Util\Debug::export($val, 2);
     } else {
         if (is_array($val)) {
             foreach ($val as $entry) {
                 self::_escapeDoctrineDump($entry);
             }
         }
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:12,代码来源:DBG.php

示例6: renderObjectDump

 /**
  * Renders a dump of the given object
  *
  * @param object $object
  * @param integer $level
  * @param boolean $renderProperties
  * @param boolean $plaintext
  * @param boolean $ansiColors
  * @return string
  */
 protected static function renderObjectDump($object, $level, $renderProperties = TRUE, $plaintext = FALSE, $ansiColors = FALSE)
 {
     $dump = '';
     $scope = '';
     $additionalAttributes = '';
     if ($object instanceof \Doctrine\Common\Collections\Collection) {
         return self::renderArrayDump(\Doctrine\Common\Util\Debug::export($object, 3), $level, $plaintext, $ansiColors);
     }
     // Objects returned from Doctrine's Debug::export function are stdClass with special properties:
     try {
         $objectIdentifier = ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', TRUE);
     } catch (\TYPO3\Flow\Reflection\Exception\PropertyNotAccessibleException $exception) {
         $objectIdentifier = spl_object_hash($object);
     }
     $className = $object instanceof \stdClass && isset($object->__CLASS__) ? $object->__CLASS__ : get_class($object);
     if (isset(self::$renderedObjects[$objectIdentifier]) || preg_match(self::getIgnoredClassesRegex(), $className) !== 0) {
         $renderProperties = FALSE;
     }
     self::$renderedObjects[$objectIdentifier] = TRUE;
     if (self::$objectManager !== NULL) {
         $objectName = self::$objectManager->getObjectNameByClassName(get_class($object));
         if ($objectName !== FALSE) {
             switch (self::$objectManager->getScope($objectName)) {
                 case \TYPO3\Flow\Object\Configuration\Configuration::SCOPE_PROTOTYPE:
                     $scope = 'prototype';
                     break;
                 case \TYPO3\Flow\Object\Configuration\Configuration::SCOPE_SINGLETON:
                     $scope = 'singleton';
                     break;
                 case \TYPO3\Flow\Object\Configuration\Configuration::SCOPE_SESSION:
                     $scope = 'session';
                     break;
             }
         } else {
             $additionalAttributes .= ' debug-unregistered';
         }
     }
     if ($renderProperties === TRUE && !$plaintext) {
         if ($scope === '') {
             $scope = 'prototype';
         }
         $scope .= '<a id="o' . $objectIdentifier . '"></a>';
     }
     if ($plaintext) {
         $dump .= $className;
         $dump .= $scope !== '' ? ' ' . self::ansiEscapeWrap($scope, '44;37', $ansiColors) : '';
     } else {
         $dump .= '<span class="debug-object' . $additionalAttributes . '" title="' . $objectIdentifier . '">' . $className . '</span>';
         $dump .= $scope !== '' ? '<span class="debug-scope">' . $scope . '</span>' : '';
     }
     if (property_exists($object, 'Persistence_Object_Identifier')) {
         $persistenceIdentifier = $objectIdentifier;
         $persistenceType = 'persistable';
     } elseif ($object instanceof \Closure) {
         $persistenceIdentifier = 'n/a';
         $persistenceType = 'closure';
     } else {
         $persistenceIdentifier = 'unknown';
         $persistenceType = 'object';
     }
     if ($plaintext) {
         $dump .= ' ' . self::ansiEscapeWrap($persistenceType, '42;37', $ansiColors);
     } else {
         $dump .= '<span class="debug-ptype" title="' . $persistenceIdentifier . '">' . $persistenceType . '</span>';
     }
     if ($object instanceof \TYPO3\Flow\Object\Proxy\ProxyInterface || property_exists($object, '__IS_PROXY__') && $object->__IS_PROXY__ === TRUE) {
         if ($plaintext) {
             $dump .= ' ' . self::ansiEscapeWrap('proxy', '41;37', $ansiColors);
         } else {
             $dump .= '<span class="debug-proxy" title="' . $className . '">proxy</span>';
         }
     }
     if ($renderProperties === TRUE) {
         if ($object instanceof \SplObjectStorage) {
             $dump .= ' (' . (count($object) ?: 'empty') . ')';
             foreach ($object as $value) {
                 $dump .= chr(10);
                 $dump .= str_repeat(' ', $level);
                 $dump .= self::renderObjectDump($value, 0, FALSE, $plaintext, $ansiColors);
             }
         } else {
             $classReflection = new \ReflectionClass($className);
             $properties = $classReflection->getProperties();
             foreach ($properties as $property) {
                 if (preg_match(self::$blacklistedPropertyNames, $property->getName())) {
                     continue;
                 }
                 $dump .= chr(10);
                 $dump .= str_repeat(' ', $level) . ($plaintext ? '' : '<span class="debug-property">') . self::ansiEscapeWrap($property->getName(), '36', $ansiColors) . ($plaintext ? '' : '</span>') . ' => ';
                 $property->setAccessible(TRUE);
//.........这里部分代码省略.........
开发者ID:sengkimlong,项目名称:Flow3-Authentification,代码行数:101,代码来源:Debugger.php

示例7: getEntityOrException

 /**
  * @param string $entityName
  * @param mixed  $criteria
  *
  * @throws \InvalidArgumentException If entity is not found
  *
  * @return object
  */
 public function getEntityOrException($entityName, $criteria)
 {
     $entity = $this->findEntity($entityName, $criteria);
     if (!$entity) {
         if (is_string($criteria)) {
             $criteria = ['code' => $criteria];
         }
         throw new \InvalidArgumentException(sprintf('Could not find "%s" with criteria %s', $this->getEntities()[$entityName], print_r(\Doctrine\Common\Util\Debug::export($criteria, 2), true)));
     }
     return $entity;
 }
开发者ID:bengrol,项目名称:pim-community-dev,代码行数:19,代码来源:FixturesContext.php

示例8: export

 /**
  * @param mixed $value
  * @return string
  */
 private static function export($value = null)
 {
     $value = Debug::export($value, self::LEVEL_DEPTH);
     // if $context was object - he will be converted to \StdClass
     if ($value instanceof \StdClass) {
         $value = (array) $value;
     }
     return stripslashes(var_export($value, true));
 }
开发者ID:datravel,项目名称:php-debug,代码行数:13,代码来源:Log.php

示例9: _escapeDoctrineDump

 private static function _escapeDoctrineDump(&$val)
 {
     if ($val instanceof \Cx\Model\Base\EntityBase || $val instanceof \Doctrine\DBAL\Statement || $val instanceof \Doctrine\DBAL\Connection || $val instanceof \Cx\Core_Modules\MultiSite\Model\Entity\Domain || $val instanceof \Cx\Core\Core\Model\Entity\EntityBase || $val instanceof \Doctrine\ORM\Mapping\ClassMetadata || $val instanceof \Cx\Core\Core\Controller\Cx || $val instanceof \Cx\Core\Html\Sigma || $val instanceof \Cx\Core\Core\Model\Entity\SystemComponentController) {
         $val = \Doctrine\Common\Util\Debug::export($val, 2);
     } else {
         if (is_array($val)) {
             foreach ($val as &$entry) {
                 self::_escapeDoctrineDump($entry);
             }
         }
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:12,代码来源:DBG.php

示例10: prepareData

 /**
  * Prepare data for logging
  *
  * @param mixed $data
  *
  * @return mixed
  */
 protected static function prepareData($data)
 {
     if (is_array($data)) {
         foreach ($data as $k => $v) {
             $data[$k] = static::prepareData($v);
         }
     } elseif (is_object($data)) {
         $data = \Doctrine\Common\Util\Debug::export($data, 2);
     }
     return $data;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:18,代码来源:Logger.php

示例11: getDump

 public static function getDump($item, $maxDepth = 3)
 {
     ini_set('html_errors', 'On');
     if (extension_loaded('xdebug')) {
         ini_set('xdebug.var_display_max_depth', $maxDepth);
     }
     $var = \Doctrine\Common\Util\Debug::export($item, $maxDepth++);
     ob_start();
     var_dump($var);
     $dump = ob_get_contents();
     ob_end_clean();
     return strip_tags(html_entity_decode($dump));
     ini_set('html_errors', 'Off');
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:14,代码来源:Helper.php

示例12: testExportArrayObject

 public function testExportArrayObject()
 {
     $obj = new \ArrayObject(array('foobar'));
     $var = Debug::export($obj, 2);
     $this->assertContains('foobar', $var->__STORAGE__);
 }
开发者ID:nemekzg,项目名称:common,代码行数:6,代码来源:DebugTest.php

示例13: testExportDateTime

 public function testExportDateTime()
 {
     $obj = new \DateTime("2010-10-10 10:10:10");
     $var = Debug::export($obj, 2);
     $this->assertEquals("DateTime", $var->__CLASS__);
 }
开发者ID:GMBN,项目名称:ZF2---DoctrineModule---ManyToOne-,代码行数:6,代码来源:DebugTest.php


注:本文中的Doctrine\Common\Util\Debug::export方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。