Пример #1
0
 public function __construct($class, $property, $default = null)
 {
     $property = new \ReflectionProperty($class, $property);
     list($description, $tags) = $this->userguide->parse($property->getDocComment());
     $this->description = $description;
     if ($modifiers = $property->getModifiers()) {
         $this->modifiers = '<small>' . implode(' ', \Reflection::getModifierNames($modifiers)) . '</small> ';
     }
     if (isset($tags['var'])) {
         if (preg_match('/^(\\S*)(?:\\s*(.+?))?$/s', $tags['var'][0], $matches)) {
             $this->type = $matches[1];
             if (isset($matches[2])) {
                 $this->description = $this->markdown->transform($matches[2]);
             }
         }
     }
     $this->property = $property;
     // Show the value of static properties, but only if they are public or we are php 5.3 or
     // higher and can force them to be accessible
     if ($property->isStatic()) {
         $property->setAccessible(true);
         // Don't debug the entire object, just say what kind of object it is
         if (is_object($property->getValue($class))) {
             $this->value = '<pre>object ' . get_class($property->getValue($class)) . '()</pre>';
         } else {
             $this->value = Debug::vars($property->getValue($class));
         }
     }
     // Store the defult property
     $this->default = Debug::vars($default);
 }
Пример #2
0
 public function __construct($method, $param)
 {
     $this->param = new \ReflectionParameter($method, $param);
     $this->name = $this->param->name;
     if ($this->param->isDefaultValueAvailable()) {
         $this->default = Debug::dump($this->param->getDefaultValue());
     }
     if ($this->param->isPassedByReference()) {
         $this->reference = true;
     }
     if ($this->param->isOptional()) {
         $this->optional = true;
     }
 }
Пример #3
0
 /**
  * Get a single line of text representing the exception:
  *
  *
  *
  * @param   Exception   Error exception to log
  * @return  string      In the format Error [ Code ]: Message ~ File [ Line ]
  */
 public static function text(\Exception $e)
 {
     return sprintf('%s [ %s ]: %s ~ %s [ %d ]', get_class($e), $e->getCode(), strip_tags($e->getMessage()), Debug::path($e->getFile()), $e->getLine());
 }
Пример #4
0
 /**
  * Gets the class file path
  *
  * @return  string
  * @author  Neil Brayfield
  **/
 public function filename()
 {
     if (!$this->class->getFilename()) {
         return false;
     } else {
         return Debug::path($this->class->getFilename());
     }
 }
Пример #5
0
 /**
  * Tests Debug::dump()
  *
  * @test
  * @dataProvider provider_dump
  * @covers Debug::dump
  * @covers Debug::_dump
  * @param object $exception exception to test
  * @param string $expected  expected output
  */
 public function test_dump($input, $length, $limit, $expected)
 {
     $this->assertEquals($expected, Debug::dump($input, $length, $limit));
 }