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


PHP Debug::dump方法代码示例

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


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

示例1: execute

 /**
  * @see Console\Command\Command
  */
 protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
 {
     $dm = $this->getHelper('dm')->getDocumentManager();
     $query = json_decode($input->getArgument('query'));
     $cursor = $dm->getRepository($input->getArgument('class'))->findBy((array) $query);
     $cursor->hydrate((bool) $input->getOption('hydrate'));
     $depth = $input->getOption('depth');
     if (!is_numeric($depth)) {
         throw new \LogicException("Option 'depth' must contain an integer value");
     }
     if (($skip = $input->getOption('skip')) !== null) {
         if (!is_numeric($skip)) {
             throw new \LogicException("Option 'skip' must contain an integer value");
         }
         $cursor->skip((int) $skip);
     }
     if (($limit = $input->getOption('limit')) !== null) {
         if (!is_numeric($limit)) {
             throw new \LogicException("Option 'limit' must contain an integer value");
         }
         $cursor->limit((int) $limit);
     }
     $resultSet = $cursor->toArray();
     \Doctrine\Common\Util\Debug::dump($resultSet, $depth);
 }
开发者ID:noikiy,项目名称:inovi,代码行数:28,代码来源:QueryCommand.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $app = $this->getHelper("app")->getApplication();
     $ns = $app["url_shortener.ns"];
     $link = $app[$ns . 'shortener_service']->shorten($input->getArgument("url"), $input->getOption("custom"));
     $output->writeln(Debug::dump($link));
 }
开发者ID:mparaiso,项目名称:urlshortenerappserviceprovider,代码行数:7,代码来源:ShortenCommand.php

示例3: listAllByUserAction

 /**
  * @Route("/listby", name="listby")
  */
 public function listAllByUserAction(Request $request)
 {
     $loggedInUser = $this->getUser();
     $em = $this->getDoctrine()->getEntityManager();
     $jobsOrderedByTitle = $em->getRepository('AppBundle:Job')->findAllByUser($loggedInUser);
     Debug::dump($jobsOrderedByTitle);
 }
开发者ID:slavisaperisic,项目名称:hrapp,代码行数:10,代码来源:JSONController.php

示例4: dump

 /**
  * Function that dumps an array or object. It uses the Doctrine dumper so we don't
  * get annoyed by Doctrine objects recursions.
  *
  * @param  $var          mixed   Variable to dump
  * @param  $name         string  Name of the var to dump
  * @param  $die          Boolean Tells the function to stop the process or not
  * @param  $maxDepth     integer Max depth allowed when debugging objects
  * @param  $returnBuffer Boolean Tells if the debug must be returned as a string
  *
  * @return string|null
  */
 public function dump($var, $name = 'var', $die = false, $maxDepth = 2, $returnBuffer = false)
 {
     ob_start();
     echo '<br/><pre>' . $name . (is_object($var) ? ' (' . get_class($var) . ')' : '') . ' :<br/>';
     DoctrineDebug::dump($var, $maxDepth);
     echo '</pre>';
     $buffer = ob_get_contents();
     ob_end_clean();
     $backtrace = debug_backtrace();
     $dieMsg = '<pre><b>Process stopped by "coils.tools.debug" service</b>' . PHP_EOL;
     $dieMsg .= isset($backtrace[0]['file']) ? '&raquo; file     : <b>' . $backtrace[0]['file'] . '</b>' . PHP_EOL : '';
     $dieMsg .= isset($backtrace[0]['line']) ? '&raquo; line     : <b>' . $backtrace[0]['line'] . '</b>' . PHP_EOL : '';
     $dieMsg .= isset($backtrace[1]['class']) ? '&raquo; class    : <b>' . $backtrace[1]['class'] . '</b>' . PHP_EOL : '';
     $dieMsg .= isset($backtrace[1]['function']) ? '&raquo; function : <b>' . $backtrace[1]['function'] . '</b>' . PHP_EOL : '';
     $dieMsg .= '</pre>';
     if ($returnBuffer) {
         return $buffer;
     } else {
         echo $buffer;
     }
     if (true == $die) {
         die($dieMsg);
     } else {
         echo $dieMsg;
     }
 }
开发者ID:nvdnkpr,项目名称:ToolsBundle,代码行数:38,代码来源:Debug.php

示例5: dump

 /**
  * {@inheritdoc}
  */
 public function dump($input, $name = NULL)
 {
     if ($name) {
         echo $name . ' => ';
     }
     Debug::dump($input);
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:10,代码来源:DoctrineDebug.php

示例6: dump

 /**
  * Dumps debug data to the debug logger.
  *
  * @param mixed ... $params
  *
  * @return string
  */
 public static function dump(...$params)
 {
     $htmlResult = '';
     $debugFactory = new DebugFactory();
     $logger = $debugFactory->getDebugLogger();
     $handleEnity = function ($value, &$result) {
         ob_start();
         \Doctrine\Common\Util\Debug::dump($value);
         $result .= ob_get_contents();
         ob_end_clean();
     };
     foreach ($params as $value) {
         if ($value === true) {
             $htmlResult .= '{true}';
         } elseif ($value === false) {
             $htmlResult .= '{true}';
         } elseif ($value === null) {
             $htmlResult .= '{null}';
         } elseif ($value instanceof Entity) {
             $handleEnity($value, $htmlResult);
         } elseif (is_array($value) && isset($value[0]) && $value[0] instanceof Entity) {
             foreach ($value as $v) {
                 $handleEnity($v, $htmlResult);
             }
         } else {
             $htmlResult .= print_r($value, true);
         }
     }
     $logger->debug($htmlResult);
     return $htmlResult;
 }
开发者ID:messyOne,项目名称:Loo-Framework,代码行数:38,代码来源:Debug.php

示例7: createAction

 /**
  * Creates a new Rooms entity.
  *
  */
 public function createAction(Request $request, $hotelId)
 {
     $entity = new Rooms();
     $form = $this->createCreateForm($entity, $hotelId);
     $form->handleRequest($request);
     $em = $this->getDoctrine()->getManager();
     $entitiesHotelSeasons = $em->getRepository('KvartiriBundle:Hotels')->find($hotelId);
     if ($form->isValid()) {
         $hotelSeason = $request->get('hotelseasons');
         $price = $request->get('price');
         /*             * Ma logique pour enregistrer les prix* */
         \Doctrine\Common\Util\Debug::dump($price);
         $index = 0;
         foreach ($hotelSeason as $hotels) {
             $roomSeasons[$hotels] = new RoomSeasons();
             // $rooms = new Rooms();
             $HotelSeasons = $em->getRepository('KvartiriBundle:HotelSeasons')->find($hotels);
             $roomSeasons[$hotels]->setPrice($price[$index]);
             $roomSeasons[$hotels]->addHotelSeason($HotelSeasons);
             $entity->addRoomSeason($roomSeasons[$hotels]);
             //$em->persist($value);
             //   $rooms->getRoomSeasons()->add($HotelSeasons);
             //   \Doctrine\Common\Util\Debug::dump($roomSeasons[0]);
             $index++;
         }
         foreach ($roomSeasons as $value) {
             $em->persist($value);
         }
         $em->persist($entity);
         $em->flush();
         return $this->redirect($this->generateUrl('adminRooms_show', array('id' => $entity->getId(), 'hotelId' => $hotelId)));
     }
     return $this->render('KvartiriBundle:Admin:Rooms/new.html.twig', array('entity' => $entity, 'form' => $form->createView(), 'hotelsSeasons' => $entitiesHotelSeasons->getHotelSeasons()));
 }
开发者ID:kvartiri,项目名称:kvartiri,代码行数:38,代码来源:RoomsAdminController.php

示例8: nieginie

/**
 * Inspiracja: https://www.youtube.com/watch?v=P17pg55FbvA.
 *
 * @param mixed      $data
 * @param string|int $mode
 *                             1: [-012]: (def: 0), -0: ::dump(), 1: var_dump(), 2: print_r()
 *                             2: [01]  : (def: 0), 0: pre, 1: nopre
 * @param int        $maxDepth
 * @param bool       $return   - def: false, czy ma zwrócić wynik zamiast wyprintować na ekran
 *
 * @return string
 */
function nieginie($data, $mode = null, $maxDepth = 2, $return = false, $force = false, $trace = null)
{
    if ($force || isdebug()) {
        $trace or $trace = debug_backtrace();
        $trace = array_shift($trace);
        $return and ob_start();
        if (is_null($mode)) {
            $mode = '00';
        }
        $mode = str_pad($mode, 2, '0');
        if ($mode[1] == 0) {
            echo '<pre>';
        }
        echo $trace['file'] . ':' . $trace['line'] . PHP_EOL;
        $k = $mode[0];
        if (in_array($k, array('-', '0', '1'))) {
            if (in_array($k, array('-', '0')) && class_exists('Doctrine\\Common\\Util\\Debug')) {
                //        echo '--== Uwaga Debug::dump() wycina znaczniki html ==--'.PHP_EOL;
                echo 'Debug::dump()' . PHP_EOL;
                ob_start();
                \Doctrine\Common\Util\Debug::dump($data, $maxDepth, true);
                echo ob_get_clean();
            } else {
                echo 'var_dump()' . PHP_EOL;
                var_dump($data);
            }
        } else {
            echo 'print_r()' . PHP_EOL;
            print_r($data);
        }
        return $return ? ob_get_clean() : null;
    }
}
开发者ID:stopsopa,项目名称:utils,代码行数:45,代码来源:CommonTools.php

示例9: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->getHelper('em')->getEntityManager();
     if (($dql = $input->getArgument('dql')) === null) {
         throw new \RuntimeException("Argument 'DQL' is required in order to execute this command correctly.");
     }
     $depth = $input->getOption('depth');
     if (!is_numeric($depth)) {
         throw new \LogicException("Option 'depth' must contains an integer value");
     }
     $hydrationModeName = $input->getOption('hydrate');
     $hydrationMode = 'Doctrine\\ORM\\Query::HYDRATE_' . strtoupper(str_replace('-', '_', $hydrationModeName));
     if (!defined($hydrationMode)) {
         throw new \RuntimeException("Hydration mode '{$hydrationModeName}' does not exist. It should be either: object. array, scalar or single-scalar.");
     }
     $query = $em->createQuery($dql);
     if (($firstResult = $input->getOption('first-result')) !== null) {
         if (!is_numeric($firstResult)) {
             throw new \LogicException("Option 'first-result' must contains an integer value");
         }
         $query->setFirstResult((int) $firstResult);
     }
     if (($maxResult = $input->getOption('max-result')) !== null) {
         if (!is_numeric($maxResult)) {
             throw new \LogicException("Option 'max-result' must contains an integer value");
         }
         $query->setMaxResults((int) $maxResult);
     }
     $resultSet = $query->execute(array(), constant($hydrationMode));
     Debug::dump($resultSet, $input->getOption('depth'));
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:34,代码来源:RunDqlCommand.php

示例10: render

 /**
  * A wrapper for var_dump() or Doctrine's Dump Utility.
  *
  * @param string $title optional custom title for the debug output
  * @param integer $maxDepth Sets the max recursion depth of the dump (defaults to 8). De- or increase the number according to your needs and memory limit.
  * @param boolean $plainText If TRUE, the dump is in plain text, if FALSE the debug output is in HTML format.
  * @param boolean $ansiColors If TRUE, ANSI color codes is added to the plaintext output, if FALSE (default) the plaintext debug output not colored.
  * @param boolean $inline if TRUE, the dump is rendered at the position of the <f:debug> tag. If FALSE (default), the dump is displayed at the top of the page.
  * @param array $blacklistedClassNames An array of class names (RegEx) to be filtered. Default is an array of some common class names.
  * @param array $blacklistedPropertyNames An array of property names and/or array keys (RegEx) to be filtered. Default is an array of some common property names.
  * @return string
  */
 public function render($title = NULL, $maxDepth = 8, $plainText = FALSE, $ansiColors = FALSE, $inline = FALSE, $blacklistedClassNames = NULL, $blacklistedPropertyNames = NULL)
 {
     if (class_exists('Doctrine\\Common\\Util\\Debug')) {
         return \Doctrine\Common\Util\Debug::dump($this->renderChildren(), $maxDepth, !$plainText);
     }
     return var_export($this->renderChildren(), TRUE);
 }
开发者ID:kftseng,项目名称:fluid,代码行数:19,代码来源:DebugViewHelper.php

示例11: execute

 /**
  * @see Console\Command\Command
  */
 protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
 {
     $dm = $this->getDocumentManager();
     $qb = $dm->getRepository($input->getArgument('class'))->createQueryBuilder();
     $qb->setQueryArray((array) json_decode($input->getArgument('query')));
     $qb->hydrate((bool) $input->getOption('hydrate'));
     $depth = $input->getOption('depth');
     if (!is_numeric($depth)) {
         throw new \LogicException("Option 'depth' must contain an integer value");
     }
     if (($skip = $input->getOption('skip')) !== null) {
         if (!is_numeric($skip)) {
             throw new \LogicException("Option 'skip' must contain an integer value");
         }
         $qb->skip((int) $skip);
     }
     if (($limit = $input->getOption('limit')) !== null) {
         if (!is_numeric($limit)) {
             throw new \LogicException("Option 'limit' must contain an integer value");
         }
         $qb->limit((int) $limit);
     }
     foreach ($qb->getQuery() as $result) {
         \Doctrine\Common\Util\Debug::dump($result, $depth);
     }
 }
开发者ID:lanhongjie,项目名称:lumen-doctrine-mongodb-odm,代码行数:29,代码来源:QueryCommand.php

示例12: dumpd

function dumpd($obj, $exit = 1)
{
    echo '<pre>';
    \Doctrine\Common\Util\Debug::dump($obj);
    if ($exit) {
        die;
    }
    echo "</pre>";
}
开发者ID:sgdoc,项目名称:sgdoce-codigo,代码行数:9,代码来源:index.php

示例13: testDisablesOutput

 public function testDisablesOutput()
 {
     ob_start();
     $dump = Debug::dump('foo', 2, true, false);
     $outputValue = ob_get_contents();
     ob_end_clean();
     $this->assertEmpty($outputValue);
     $this->assertNotSame($outputValue, $dump);
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:9,代码来源:DebugTest.php

示例14: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $arguments = $this->getArguments();
     $em = $this->getConfiguration()->getAttribute('em');
     $query = $em->createQuery($arguments['dql']);
     $resultSet = $query->getResult();
     $maxDepth = isset($arguments['depth']) ? $arguments['depth'] : 7;
     Debug::dump($resultSet, $maxDepth);
 }
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:12,代码来源:RunDqlTask.php

示例15: dumpLevel

 public static function dumpLevel($var, $maxDepth = 2)
 {
     $env = getenv('APP_ENV') ?: 'production';
     if ($env != 'production') {
         echo '<pre>';
         DoctrineDebug::dump($var, $maxDepth);
         echo '</pre>';
     }
 }
开发者ID:seyfer,项目名称:zend2-tutorial.me,代码行数:9,代码来源:Debug.php


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