renderDump() public static method

Renders a dump of the given variable
public static renderDump ( mixed $variable, integer $level, boolean $plaintext = false, boolean $ansiColors = false ) : string
$variable mixed
$level integer
$plaintext boolean
$ansiColors boolean
return string
 /**
  * @test
  */
 public function ignoredClassesCanBeOverwrittenBySettings()
 {
     $object = new ApplicationContext('Development');
     $this->assertEquals(sprintf('%s prototype object', ApplicationContext::class), Debugger::renderDump($object, 10, true));
     Debugger::clearState();
     $currentConfiguration = ObjectAccess::getProperty($this->configurationManager, 'configurations', true);
     $configurationOverwrite['Settings']['Neos']['Flow']['error']['debugger']['ignoredClasses']['Neos\\\\Flow\\\\Core\\\\.*'] = false;
     $newConfiguration = Arrays::arrayMergeRecursiveOverrule($currentConfiguration, $configurationOverwrite);
     ObjectAccess::setProperty($this->configurationManager, 'configurations', $newConfiguration, true);
     $this->assertContains('rootContextString', Debugger::renderDump($object, 10, true));
 }
Example #2
0
 /**
  * Show the current status of entities and mappings
  *
  * Shows basic information about which entities exist and possibly if their
  * mapping information contains errors or not.
  *
  * To run a full validation, use the validate command.
  *
  * @param boolean $dumpMappingData If set, the mapping data will be output
  * @param string $entityClassName If given, the mapping data for just this class will be output
  * @return void
  * @see neos.flow:doctrine:validate
  */
 public function entityStatusCommand($dumpMappingData = false, $entityClassName = null)
 {
     $info = $this->doctrineService->getEntityStatus();
     if ($info === []) {
         $this->output('You do not have any mapped Doctrine ORM entities according to the current configuration. ');
         $this->outputLine('If you have entities or mapping files you should check your mapping configuration for errors.');
     } else {
         $this->outputLine('Found %d mapped entities:', [count($info)]);
         $this->outputLine();
         if ($entityClassName === null) {
             foreach ($info as $entityClassName => $entityStatus) {
                 if ($entityStatus instanceof ClassMetadata) {
                     $this->outputLine('<success>[OK]</success>   %s', [$entityClassName]);
                     if ($dumpMappingData) {
                         Debugger::clearState();
                         $this->outputLine(Debugger::renderDump($entityStatus, 0, true, true));
                     }
                 } else {
                     $this->outputLine('<error>[FAIL]</error> %s', [$entityClassName]);
                     $this->outputLine($entityStatus);
                     $this->outputLine();
                 }
             }
         } else {
             if (array_key_exists($entityClassName, $info) && $info[$entityClassName] instanceof ClassMetadata) {
                 $entityStatus = $info[$entityClassName];
                 $this->outputLine('<success>[OK]</success>   %s', [$entityClassName]);
                 if ($dumpMappingData) {
                     Debugger::clearState();
                     $this->outputLine(Debugger::renderDump($entityStatus, 0, true, true));
                 }
             } else {
                 $this->outputLine('<info>[FAIL]</info> %s', [$entityClassName]);
                 $this->outputLine('Class not found.');
                 $this->outputLine();
             }
         }
     }
 }
Example #3
0
/**
 * A var_dump function optimized for Flow's object structures
 *
 * @param mixed $variable The variable to display a dump of
 * @param string $title optional custom title for the debug output
 * @param boolean $return if TRUE, the dump is returned for displaying it embedded in custom HTML. If FALSE (default), the variable dump is directly displayed.
 * @param boolean $plaintext If TRUE, the dump is in plain text, if FALSE the debug output is in HTML format. If not specified, the mode is guessed from FLOW_SAPITYPE
 * @return void|string if $return is TRUE, the variable dump is returned. By default, the dump is directly displayed, and nothing is returned.
 * @api
 */
function var_dump($variable, $title = null, $return = false, $plaintext = null)
{
    if ($plaintext === null) {
        $plaintext = FLOW_SAPITYPE === 'CLI';
        $ansiColors = $plaintext && DIRECTORY_SEPARATOR === '/';
    } else {
        $ansiColors = false;
    }
    if ($title === null) {
        $title = 'Flow Variable Dump';
    }
    if ($ansiColors) {
        $title = "" . $title . "";
    }
    Debugger::clearState();
    if (!$plaintext && Debugger::$stylesheetEchoed === false) {
        echo '<style type="text/css">' . file_get_contents('resource://Neos.Flow/Public/Error/Debugger.css') . '</style>';
        Debugger::$stylesheetEchoed = true;
    }
    if ($plaintext) {
        $output = $title . chr(10) . Debugger::renderDump($variable, 0, true, $ansiColors) . chr(10) . chr(10);
    } else {
        $output = '
			<div class="Flow-Error-Debugger-VarDump ' . ($return ? 'Flow-Error-Debugger-VarDump-Inline' : 'Flow-Error-Debugger-VarDump-Floating') . '">
				<div class="Flow-Error-Debugger-VarDump-Top">
					' . htmlspecialchars($title) . '
				</div>
				<div class="Flow-Error-Debugger-VarDump-Center">
					<pre dir="ltr">' . Debugger::renderDump($variable, 0, false, false) . '</pre>
				</div>
			</div>
		';
    }
    if ($return === true) {
        return $output;
    } else {
        echo $output;
    }
}
 /**
  * @test
  */
 public function ignoredClassesAreNotRendered()
 {
     $object = new ApplicationContext('Development');
     $this->assertEquals('Neos\\Flow\\Core\\ApplicationContext object', Debugger::renderDump($object, 10, true));
 }