Get the view stub file for the generator.

@param string|null $method
@param string|null $name
@return string
164474
protected function getViewStub($method = null, $name = null)
    {
        if (in_array($name, [ $this->qualifyClass('ModelController'), $this->qualifyClass('Model/ChildController') ])) {
            if ($this->option('parent')) {
                return __DIR__.'/stubs/view.nested.model.'.$method.'.stub';
            } elseif ($this->option('model') || $this->option('resource')) {
                return __DIR__.'/stubs/view.model.'.$method.'.stub';
            }
        }

        if ($this->option('parent')) {
            return __DIR__.'/stubs/view.nested.'.$method.'.stub';
        } elseif ($this->option('model') || $this->option('resource')) {
            return __DIR__.'/stubs/view.'.$method.'.stub';
        }

        return __DIR__.'/stubs/view.stub';
    }
16237
protected function getMethod($name) 
    {
        if (isset(self::$_methods[$name])) {
            return $name;
        }

        if (isset(self::$_methods['array_'.$name])) {
            return 'array_'.$name;
        }

        $uncamel = strtolower(preg_replace("/([A-Z])/", "_$1", $name));

        if (isset(self::$_methods[$uncamel])) {
            return $uncamel;
        }

        if (isset(self::$_methods['array_'.$uncamel])) {
            return 'array_'.$uncamel;
        }

        return $name;
    }
824193
protected function generateStub($name)
    {
        $stub = array('#!/usr/bin/env php', '<?php');
        $stub[] = "Phar::mapPhar('$name');";
        $stub[] = "if (PHP_SAPI == 'cli') {";

        if (isset($this->index['cli'])) {
            $file = $this->index['cli'][0];
            $stub[] = " require 'phar://$name/$file';";
        } else {
            $stub[] = " exit('This program can not be invoked via the CLI version of PHP, use the Web interface instead.'.PHP_EOL);";
        }

        $stub[] = '} else {';

        if (isset($this->index['web'])) {
            $file = $this->index['web'][0];
            $stub[] = " require 'phar://$name/$file';";
        } else {
            $stub[] = " exit('This program can not be invoked via the Web interface, use the CLI version of PHP instead.'.PHP_EOL);";
        }

        $stub[] = '}';
        $stub[] = '__HALT_COMPILER();';

        return join("\n", $stub);
    }
204217
private function generateCommand($name, \ReflectionMethod $method, $token = null)
    {
        $methodName = $this->transformer->transform($method->getName());

        $command = new Command(strtolower($name . ':' . $methodName));

        $factory  = DocBlockFactory::createInstance();
        $docBlock = $factory->create($method);

        $command->setDefinition($this->buildDefinition($method, $docBlock, $token));
        $command->setDescription($docBlock->getSummary());
        $command->setCode($this->createCode($name, $method));

        return $command;
    }
578875
public function getMethod($name)
    {
        if ($this->hasMethod($name) === true) {
            return $this->methods[$name];
        } else {
            throw new InvalidArgumentException('Method "' . $name . '" is not defined.');
        }
    }
568748
private function getViewFilePath($name, $extension = 'html')
    {
        // Check view file
        $viewFile = $this->getViewFile($name, $extension);
        if (!file_exists($viewFile)) {
            // Check for view folder
            $viewBaseName = $this->getViewFolder($name) . DIRECTORY_SEPARATOR . 'view';

            // Select the view file
            $viewFile = (file_exists($viewBaseName . '.php') ? $viewBaseName . '.php' : $viewBaseName . '.html');
            $viewFile = (file_exists($viewFile) ? $viewFile : null);
        }

        // Check if the file is executable (php)
        if (preg_match('/\.php$/', $viewFile)) {
            $this->executable = true;
        }

        return $viewFile;
    }
51163
function load($name): string {
    if (!isset($this->views[$name])) {
      $cacheKey = [__CLASS__, $name];
      $viewRenderer = $this->viewRenderer;

      /** @var \yii\caching\Cache $cache */
      $cache = $viewRenderer->cache;
      if ($viewRenderer->enableCaching && $cache->exists($cacheKey))
        $output = $cache->get($cacheKey);
      else {
        $path = FileHelper::localize($this->findViewFile($name));
        if (!is_file($path)) throw new InvalidCallException("The view file '$path' does not exist.");

        $output = @file_get_contents($path);
        if ($viewRenderer->enableCaching) $cache->set($cacheKey, $output, $viewRenderer->cachingDuration);
      }

      $this->views[$name] = $output;
    }

    return $this->views[$name];
  }
1116079
public static function getFormatTemplate($name) {
        $file = sprintf(
            '%s/Model/template/format/%s.html',
            __DIR__,
            $name
        );

        if (!file_exists($file)) {
            return null;
        }

        if (!isset(self::$templates[$name])) {
            self::$templates[$name] = file_get_contents($file);
        }

        return self::$templates[$name];
    }
130035
public function get($name = null, $domain = null, $method = '*')
    {
        if (is_null($name)) {
            return $this->item;
        }

        $name = strtolower($name);
        $method = strtolower($method);

        if (isset($this->item[$name])) {
            if (is_null($domain)) {
                $result = $this->item[$name];
            } else {
                $result = [];
                foreach ($this->item[$name] as $item) {
                    if ($item[2] == $domain && ('*' == $item[4] || $method == $item[4])) {
                        $result[] = $item;
                    }
                }
            }
        } else {
            $result = null;
        }

        return $result;
    }
68865
public function getMethod($name)
    {
        $m = $this->getReflectionClass()->getMethod($name);
        return MethodInfo::__internal_create($this, $m);
    }
927121
public function getName($name = null, $domain = null, $method = '*')
    {
        return Zilf::$container->getShare('ruleName')->get($name, $domain, $method);
    }
1081800
protected function findOwnMethod($name) {
    $method = $this->getMethod($name);
    if ($this->qcn === $method->getDeclaringClassName()) {
      return $method;
    }
    return NULL;
  }
133318
public function getStub($type, $name)
    {
        if (in_array($name, $this->ignores)) {
            return;
        }

        $type = $this->getInputType($type, $name);

        return Stub::create('/form/'.$type.'.stub', [
            'name' => $name,
            'label' => ucwords(str_replace('_', ' ', $name)),
        ])->render();
    }
685411
function getOwnMethod($name) {
    if (isset($this->methods[$name])) {
      return $this->methods[$name];
    }
    if ($this->methodsComplete) {
      return NULL;
    }
    if (array_key_exists($name, $this->methodsNotFound)) {
      return NULL;
    }
    $methodObj = $this->findOwnMethod($name);
    if (NULL === $methodObj) {
      $this->methodsNotFound[$name] = TRUE;
      return NULL;
    }
    $this->methods[$name] = $methodObj;
    return $methodObj;
  }
60414
public function getMethod($name)
    {
        if ($this->reflected->hasMethod($name))
            return $this->annotations['methods'][$name];

        return null;
    }
563540
protected function getMethodTemplate($template_name, array $order, array $method)
    {
        if (empty($method['status']) || empty($method['template'][$template_name])) {
            return '';
        }

        $settings = array();
        $template = $method['template'][$template_name];

        if (!empty($method['module'])) {
            $template = "{$method['module']}|$template";
            $settings = $this->getModuleSettings($method['module']);
        }

        $data = array(
            'order' => $order,
            'method' => $method,
            'settings' => $settings
        );

        return $this->render($template, $data);
    }
265099
public function getField(string $name)
    {
        $name = trim($name);
        if (!$this->isFieldSet($name)) {
            return null;
        }

        $field_key = array_search($name, $this->keys);
        return $this->method[$field_key] ?? $_FILES[$field_key];
    }