addDocument() public méthode

Deprecation:
public addDocument ( $s )
 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     $initialize = $class->getMethod('initialize');
     $container = $this->getContainerBuilder();
     if ($this->debugMode && $this->config['debugger']) {
         $initialize->addBody($container->formatPhp('?;', array(new Nette\DI\Statement('@Tracy\\Bar::addPanel', array(new Nette\DI\Statement('Nette\\Bridges\\DITracy\\ContainerPanel'))))));
     }
     foreach (array_filter($container->findByTag('run')) as $name => $on) {
         $initialize->addBody('$this->getService(?);', array($name));
     }
     if (!empty($this->config['accessors'])) {
         $definitions = $container->getDefinitions();
         ksort($definitions);
         foreach ($definitions as $name => $def) {
             if (Nette\PhpGenerator\Helpers::isIdentifier($name)) {
                 $type = $def->getImplement() ?: $def->getClass();
                 $class->addDocument("@property {$type} \${$name}");
             }
         }
     }
 }
Exemple #2
0
 /**
  * @param PhpNamespace $namespace
  * @param ClassType $class
  * @param Column $column
  * @return void
  */
 public function doDecorate(Column $column, ClassType $class, PhpNamespace $namespace)
 {
     $column->setPhpDoc($doc = new PhpDoc());
     // Annotation
     $doc->setAnnotation('@property');
     // Type
     if ($column->isNullable()) {
         $doc->setType($this->getRealType($column) . '|NULL');
     } else {
         $doc->setType($this->getRealType($column));
     }
     // Variable
     $doc->setVariable(Helpers::camelCase($column->getName()));
     // Defaults
     if ($column->getDefault() !== NULL) {
         $doc->setDefault($this->getRealDefault($column));
     }
     // Enum
     if (!empty($enum = $column->getEnum())) {
         $doc->setEnum(Strings::upper($column->getName()));
     }
     // Relations
     if (($key = $column->getForeignKey()) !== NULL) {
         // Find foreign entity table
         $ftable = $column->getTable()->getDatabase()->getForeignTable($key->getReferenceTable());
         // Update type to Entity name
         $doc->setType($this->resolver->resolveEntityName($ftable));
         $doc->setRelation($relDoc = new PhpRelDoc());
         if ($use = $this->getRealUse($ftable, $namespace)) {
             $namespace->addUse($use);
         }
         $relDoc->setType('???');
         $relDoc->setEntity($this->resolver->resolveEntityName($ftable));
         $relDoc->setVariable('???');
     }
     // Append phpDoc to class
     $class->addDocument((string) $column->getPhpDoc());
 }
Exemple #3
0
 public function afterCompile(Nette\PhpGenerator\ClassType $class)
 {
     $initialize = $class->methods['initialize'];
     $container = $this->getContainerBuilder();
     $config = $this->getConfig($this->defaults);
     // debugger
     foreach (array('email', 'editor', 'browser', 'strictMode', 'maxLen', 'maxDepth', 'showLocation', 'scream') as $key) {
         if (isset($config['debugger'][$key])) {
             $initialize->addBody('Nette\\Diagnostics\\Debugger::$? = ?;', array($key, $config['debugger'][$key]));
         }
     }
     if ($container->parameters['debugMode']) {
         if ($config['container']['debugger']) {
             $config['debugger']['bar'][] = 'Nette\\DI\\Diagnostics\\ContainerPanel';
         }
         foreach ((array) $config['debugger']['bar'] as $item) {
             $initialize->addBody($container->formatPhp('Nette\\Diagnostics\\Debugger::getBar()->addPanel(?);', Nette\DI\Compiler::filterArguments(array(is_string($item) ? new Nette\DI\Statement($item) : $item))));
         }
         foreach ((array) $config['debugger']['blueScreen'] as $item) {
             $initialize->addBody($container->formatPhp('Nette\\Diagnostics\\Debugger::getBlueScreen()->addPanel(?);', Nette\DI\Compiler::filterArguments(array($item))));
         }
     }
     if (!empty($container->parameters['tempDir'])) {
         $initialize->addBody('Nette\\Caching\\Storages\\FileStorage::$useDirectories = ?;', array($this->checkTempDir($container->expand('%tempDir%/cache'))));
     }
     foreach ((array) $config['forms']['messages'] as $name => $text) {
         $initialize->addBody('Nette\\Forms\\Rules::$defaultMessages[Nette\\Forms\\Form::?] = ?;', array($name, $text));
     }
     if ($config['session']['autoStart'] === 'smart') {
         $initialize->addBody('$this->getByType("Nette\\Http\\Session")->exists() && $this->getByType("Nette\\Http\\Session")->start();');
     } elseif ($config['session']['autoStart']) {
         $initialize->addBody('$this->getByType("Nette\\Http\\Session")->start();');
     }
     if ($config['latte']['xhtml']) {
         $initialize->addBody('Nette\\Utils\\Html::$xhtml = ?;', array(TRUE));
     }
     if (isset($config['security']['frames']) && $config['security']['frames'] !== TRUE) {
         $frames = $config['security']['frames'];
         if ($frames === FALSE) {
             $frames = 'DENY';
         } elseif (preg_match('#^https?:#', $frames)) {
             $frames = "ALLOW-FROM {$frames}";
         }
         $initialize->addBody('header(?);', array("X-Frame-Options: {$frames}"));
     }
     foreach ($container->findByTag('run') as $name => $on) {
         if ($on) {
             $initialize->addBody('$this->getService(?);', array($name));
         }
     }
     if (!empty($config['container']['accessors'])) {
         $definitions = $container->definitions;
         ksort($definitions);
         foreach ($definitions as $name => $def) {
             if (Nette\PhpGenerator\Helpers::isIdentifier($name)) {
                 $type = $def->implement ?: $def->class;
                 $class->addDocument("@property {$type} \${$name}");
             }
         }
     }
     $initialize->addBody("@header('Content-Type: text/html; charset=utf-8');");
     $initialize->addBody('Nette\\Utils\\SafeStream::register();');
 }