예제 #1
0
 public function findByTerm($term)
 {
     $dumper = new VarDumper();
     $q = $this->getEntityManager()->createQuery('SELECT a FROM BeluhaBlogBundle:AuthorQuote a WHERE a.name LIKE :name')->setParameter('name', '%' . $term . '%');
     $dumper->dump($q);
     return $q->getResult();
     /*return $this->getEntityManager()
       ->createQuery('SELECT a FROM BeluhaBlogBundle:AuthorQuote a WHERE a.name LIKE :name')
       ->setParameter('name', $term.'%')
       ->getResult();*/
 }
예제 #2
0
 /**
  * Get a list of author for autocomplete.
  *
  * @Route("/authorquote_get_authors", name="authorquote_get_authors")
  */
 public function getAuthorQute(Request $request)
 {
     $term = $request->query->get('term', null);
     $em = $this->getDoctrine()->getManager();
     $dumper = new VarDumper();
     $dumper->dump($term);
     $authors = $em->getRepository('BeluhaBlogBundle:AuthorQuote')->findByTerm($term);
     //$dumper->dump($authors);
     $results = [];
     foreach ($authors as $author) {
         $results[] = ['id' => $author->getId(), 'name' => $author->getName(), 'label' => $author->getName()];
     }
     return new JsonResponse($results);
 }
예제 #3
0
 /**
  * List quote.
  *
  * @Route("/", name="authorquote_quote_index")
  * @Method("GET")
  */
 public function indexAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $dumer = new VarDumper();
     //$quotes = $em->getRepository('BeluhaBlogBundle:Quote')->findAll();
     $dql = "SELECT q, a FROM BeluhaBlogBundle:Quote q JOIN q.author a";
     $query = $em->createQuery($dql);
     $paginator = $this->get('knp_paginator');
     $pagination = $paginator->paginate($query, $request->query->getInt('page', 1), 5);
     $dumer->dump($pagination);
     //return $this->render('quote/index.html.twig', array(
     // 'quotes' => $quotes,
     //));
     return $this->render('quote/index.html.twig', array('pagination' => $pagination));
 }
예제 #4
0
 /**
  * Output pretty-printed arrays / objects.
  *
  * @param mixed   $var
  * @param boolean $safe
  *
  * @return string
  */
 public function printDump($var, $safe)
 {
     if ($safe || !$this->app['debug']) {
         return null;
     }
     return VarDumper::dump($var);
 }
예제 #5
0
 /**
  * @param mixed $var
  */
 function appendLog($var)
 {
     static $handler = null;
     if ($handler === null) {
         $logDir = LOG_DIR;
         assert(is_dir($logDir), 'log dir "' . $logDir . '" must be a dir');
         $logDir .= '/' . date('Ymd');
         if (!is_dir($logDir)) {
             $success = mkdir($logDir);
             assert($success, 'log dir create failed: ' . $logDir . ': ' . json_encode(error_get_last()));
         }
         $logFile = $logDir . '/' . GAME_VERSION;
         $cloner = new VarCloner();
         $dumper = new CliDumper($logFile);
         $handler = function ($var) use($cloner, $dumper) {
             $dumper->dump($cloner->cloneVar($var));
         };
     }
     $origHandler = VarDumper::setHandler($handler);
     VarDumper::dump(date('c'));
     foreach (func_get_args() as $var) {
         VarDumper::dump($var);
     }
     VarDumper::setHandler($origHandler);
 }
예제 #6
0
파일: UtilsHandler.php 프로젝트: bolt/bolt
 /**
  * Output pretty-printed backtrace.
  *
  * @param integer $depth
  * @param boolean $safe
  *
  * @return string|null
  */
 public function printBacktrace($depth, $safe)
 {
     if (!$this->allowDebug($safe)) {
         return null;
     }
     return VarDumper::dump(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, $depth));
 }
예제 #7
0
파일: Dump.php 프로젝트: cawaphp/cawa
 /**
  * {@inheritdoc}
  */
 protected function send(Event $event) : bool
 {
     $handler = VarDumper::setHandler();
     dump($event->format());
     VarDumper::setHandler($handler);
     return true;
 }
예제 #8
0
 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app['dump'] = $app->protect(function ($var) use($app) {
         if (!$app['debug']) {
             return;
         }
         $app['dumper']->dump($app['dumper.cloner']->cloneVar($var));
     });
     VarDumper::setHandler(function ($var) use($app) {
         /*
          * Referencing $app['dump'] in anonymous function
          * so the closure can be replaced in $app without
          * breaking the reference here.
          */
         return $app['dump']($var);
     });
     $app['dumper'] = $app->share(function ($app) {
         return PHP_SAPI === 'cli' ? $app['dumper.cli'] : $app['dumper.html'];
     });
     $app['dumper.cli'] = $app->share(function () {
         return new CliDumper();
     });
     $app['dumper.html'] = $app->share(function () {
         return new HtmlDumper();
     });
     $app['dumper.cloner'] = $app->share(function () {
         $cloner = new VarCloner();
         $cloner->addCasters(Caster\FilesystemCasters::getCasters());
         return $cloner;
     });
 }
예제 #9
0
    /**
     * @dataProvider getDumpTags
     */
    public function testDumpTag($template, $debug, $expectedOutput, $expectedDumped)
    {
        $extension = new DumpExtension(new VarCloner());
        $twig = new \Twig_Environment(new \Twig_Loader_String(), array(
            'debug' => $debug,
            'cache' => false,
            'optimizations' => 0,
        ));
        $twig->addExtension($extension);

        $dumped = null;
        $exception = null;
        $prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) {$dumped = $var;});

        try {
            $this->assertEquals($expectedOutput, $twig->render($template));
        } catch (\Exception $exception) {
        }

        VarDumper::setHandler($prevDumper);

        if (null !== $exception) {
            throw $exception;
        }

        $this->assertSame($expectedDumped, $dumped);
    }
예제 #10
0
 public function configure()
 {
     $cloner = $this->cloner;
     $dumper = $this->dumper;
     VarDumper::setHandler(function ($var) use($cloner, $dumper) {
         $dumper->dump($cloner->cloneVar($var));
     });
 }
예제 #11
0
 public function boot(Application $app)
 {
     VarDumper::setHandler(function ($var) {
         $cloner = new VarCloner();
         $dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper();
         $dumper->dump($cloner->cloneVar($var));
     });
 }
예제 #12
0
 public function __construct($workingPath)
 {
     $this->setWorkingPath($workingPath);
     if (is_dir($this->getWorkingPath())) {
         VarDumper::dump(Finder::create()->in($this->getWorkingPath())->directories()->count());
         VarDumper::dump(Finder::create()->in($this->getWorkingPath())->files()->count());
     }
 }
예제 #13
0
 public function symfony($v, $stop = false)
 {
     echo '<pre style="' . $this->getStyle() . '">';
     SymfonyVarDumper::dump($v);
     echo '</pre>';
     if ($stop) {
         exit;
     }
 }
예제 #14
0
 /**
  * @Route("/", name="homepage")
  */
 public function indexAction(Request $request)
 {
     /* @var $repo EntityRepository */
     $repo = $this->getDoctrine()->getManager()->getRepository('AppBundle:Page');
     $pages = $repo->findAll();
     VarDumper::dump($pages[0]);
     // replace this example code with whatever you need
     return $this->render('default/index.html.twig', array('base_dir' => realpath($this->container->getParameter('kernel.root_dir') . '/..'), 'pages' => $pages));
 }
 public function boot(Application $app)
 {
     // This code is here to lazy load the dump stack. This default
     // configuration for CLI mode is overridden in HTTP mode on
     // 'kernel.request' event
     VarDumper::setHandler(function ($var) use($app) {
         $dumper = new CliDumper();
         $dumper->dump($app['var_dumper.cloner']->cloneVar($var));
     });
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $data = $this->extractRouteNumbers();
     foreach ($data['day'] as $dayBus) {
         $busRoute = new BusRoute();
         $busRoute->setNumber($dayBus);
         $busRoute->setNightBus(false);
     }
     VarDumper::dump($data);
     return 0;
 }
예제 #17
0
파일: Debug.php 프로젝트: tourze/base
 /**
  * 返回变量的打印html
  *
  *     // 可以打印多个变量
  *     echo self::vars($foo, $bar, $baz);
  *
  * @return string
  */
 public static function vars()
 {
     if (func_num_args() === 0) {
         return null;
     }
     $variables = func_get_args();
     $output = [];
     foreach ($variables as $var) {
         $output[] = VarDumper::dump($var);
     }
     return implode("\n", $output);
 }
예제 #18
0
 public function boot(Application $app)
 {
     if (!$app['debug']) {
         return;
     }
     // This code is here to lazy load the dump stack. This default
     // configuration for CLI mode is overridden in HTTP mode on
     // 'kernel.request' event
     VarDumper::setHandler(function ($var) use($app) {
         VarDumper::setHandler($handler = function ($var) use($app) {
             $app['var_dumper.cli_dumper']->dump($app['var_dumper.cloner']->cloneVar($var));
         });
         $handler($var);
     });
 }
예제 #19
0
 public function configure()
 {
     if ($this->container) {
         $container = $this->container;
         $dumper = $this->dumper;
         $this->container = null;
         VarDumper::setHandler(function ($var) use($container, $dumper) {
             $dumper = $container->get($dumper);
             $cloner = $container->get('var_dumper.cloner');
             $handler = function ($var) use($dumper, $cloner) {
                 $dumper->dump($cloner->cloneVar($var));
             };
             VarDumper::setHandler($handler);
             $handler($var);
         });
     }
 }
예제 #20
0
 public function boot()
 {
     if ($this->container->getParameter('kernel.debug')) {
         $container = $this->container;
         // This code is here to lazy load the dump stack. This default
         // configuration for CLI mode is overridden in HTTP mode on
         // 'kernel.request' event
         VarDumper::setHandler(function ($var) use($container) {
             $dumper = new CliDumper();
             $cloner = $container->get('var_dumper.cloner');
             $handler = function ($var) use($dumper, $cloner) {
                 $dumper->dump($cloner->cloneVar($var));
             };
             VarDumper::setHandler($handler);
             $handler($var);
         });
     }
 }
예제 #21
0
파일: functions.php 프로젝트: cawaphp/cawa
 /**
  * @param mixed $vars
  */
 function systrace(...$vars)
 {
     openlog('php-debug', LOG_PID, LOG_USER);
     $cloner = new VarCloner();
     $dumper = new \Symfony\Component\VarDumper\Dumper\CliDumper();
     $dumper::$defaultColors = true;
     $handler = function ($var) use($cloner, $dumper) {
         $dumper->dump($cloner->cloneVar($var), function ($line, $depth, $indentPad) {
             syslog(LOG_DEBUG, str_repeat($indentPad, $depth < 0 ? 0 : $depth) . $line);
         });
     };
     $prevHandler = VarDumper::setHandler($handler);
     if (sizeof($vars) == 1) {
         VarDumper::dump($vars[0]);
     } else {
         VarDumper::dump($vars);
     }
     VarDumper::setHandler($prevHandler);
     closelog();
 }
예제 #22
0
 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app['dump'] = $app->protect(function ($var) use($app) {
         $app['dumper']->dump($app['dumper.cloner']->cloneVar($var));
     });
     VarDumper::setHandler($app['dump']);
     $app['dumper'] = $app->share(function ($app) {
         return PHP_SAPI === 'cli' ? $app['dumper.cli'] : $app['dumper.html'];
     });
     $app['dumper.cli'] = $app->share(function () {
         return new CliDumper();
     });
     $app['dumper.html'] = $app->share(function () {
         return new HtmlDumper();
     });
     $app['dumper.cloner'] = $app->share(function () {
         $cloner = new VarCloner();
         $cloner->addCasters(Caster\FilesystemCasters::getCasters());
         return $cloner;
     });
 }
 public function testConfigure()
 {
     $prevDumper = VarDumper::setHandler('var_dump');
     VarDumper::setHandler($prevDumper);
     $cloner = new MockCloner();
     $dumper = new MockDumper();
     ob_start();
     $exception = null;
     $listener = new DumpListener($cloner, $dumper);
     try {
         $listener->configure();
         VarDumper::dump('foo');
         VarDumper::dump('bar');
         $this->assertSame('+foo-+bar-', ob_get_clean());
     } catch (\Exception $exception) {
     }
     VarDumper::setHandler($prevDumper);
     if (null !== $exception) {
         throw $exception;
     }
 }
예제 #24
0
 /**
  * Override Symfony's default handler to get the output
  */
 protected function stubVarDumper()
 {
     VarDumper::setHandler(function ($var) {
         return $var;
     });
 }
예제 #25
0
 /**
  * Output pretty-printed backtrace.
  *
  * @param int $depth
  *
  * @return string|null
  */
 public function printBacktrace($depth = 15)
 {
     if ($this->safe || !$this->app['debug']) {
         return null;
     }
     return VarDumper::dump(debug_backtrace());
 }
예제 #26
0
파일: sf_var_dumper.php 프로젝트: yfix/yf
 function dump($var)
 {
     foreach (func_get_args() as $var) {
         \Symfony\Component\VarDumper\VarDumper::dump($var);
     }
 }
예제 #27
0
 public function testTurler()
 {
     $client = new \SistemApi\ApiClient('X-IFSISTEM-TOKEN', 'http://ifsistem.app/api/v1');
     $haberler = $client->haber->liste((new \SistemApi\Model\Ayar\HaberListeAyar())->setOrderByYayinBaslangicZamani()->setAdet(4));
     \Symfony\Component\VarDumper\VarDumper::dump($haberler);
 }
예제 #28
0
 /**
  * CLI output of the debug backtrace
  *
  * @author Art <*****@*****.**>
  *
  * @param array  $trace The debug backtrace
  * @param string $label Colour id
  *
  * @codeCoverageIgnore
  */
 private function traceCLI(array $trace, $label)
 {
     foreach ($trace as $k => $v) {
         $func = $loc = $line = '';
         $argsPresent = isset($v['args']) && !empty($v['args']);
         self::formatTraceLine($v, $func, $loc, $line);
         $this->console->write('<' . $label . 'b>#' . $k . ': </>')->write('<' . $label . '>' . ($loc ? $loc : '<<unknown file>>') . '</> ')->write('<' . $label . '>(' . ($line ? 'line ' . $line : 'unknown line') . ')</>')->write('<' . $label . '> | </>')->write('<' . $label . '>' . $func . '</>', true);
         if ($argsPresent) {
             $this->console->write('<' . $label . 'b>Arguments:</>', true);
             VarDumper::dump($v['args']);
         }
         $this->console->writeln('');
     }
 }
예제 #29
0
 function dd($var)
 {
     VarDumper::dump($var);
 }
예제 #30
0
 /**
  * @author Nicolas Grekas <*****@*****.**>
  */
 function dump($var)
 {
     foreach (func_get_args() as $var) {
         VarDumper::dump($var);
     }
 }