Add a variable

@param string      $name    The name
@param string|null $type    The type
@param bool|null   $dynamic Is dynamic
@return KBEntry The newly created KBEntry
198498
public function addVariable(string $name, ?string $type, ?bool $dynamic): KBEntry
    {
        $kbe          = new KBEntry($name, $type, $dynamic);
        $this->vars[] = $kbe;
        return $kbe;
    }
1015183
public static function create($name, $type = NULL, $defaultValue = self::UNDEFINED, $modifiers = self::MODIFIER_PROTECTED) {
    if (isset($type)) {
      if ($type instanceof GClass) {
        $type = new ObjectType(new GClass($type->getFQN()));
      } elseif (!($type instanceof Type)) {
        $type = Type::create($type);
      }
    }
    
    return new static($name, $type, $defaultValue, $modifiers);
  }
259900
public function add($name, $type = 'text', array $options = [], $modify = false)
    {
        $this->formHelper->checkFieldName($name, get_class($this));

        if ($this->rebuilding && !$this->has($name)) {
            return $this;
        }

        $this->addField($this->makeField($name, $type, $options), $modify);

        return $this;
    }
285127
private function add(string $name, string $type, bool $verify = false) : bool
  {
    $models = ModulusCLI::$appdir . 'app';
    $groups = ModulusCLI::$appdir . 'app' . DIRECTORY_SEPARATOR . 'Groupables';
    $controllers = ModulusCLI::$appdir . 'app' . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'Controllers';

    $modelcontent = Template::asset('model_template');
    $groupcontent = Template::asset('group_template');
    $controllercontent = Template::asset(($this->resource == true ? 'controller_resource_template' : 'controller_template'));

    $model = $models . DIRECTORY_SEPARATOR . $name . '.php';
    $group = $groups . DIRECTORY_SEPARATOR . $name . 'Group.php';
    $controller = $controllers . DIRECTORY_SEPARATOR . $name . '.php';

    $namespace = '';

    if ($verify) {
      if ($type == 'controller' && file_exists($controller)) return true;
      if ($type == 'model' && (file_exists($model) || file_exists($group))) return true;

      return false;
    }

    if (substr_count($name, '/') > 0) {
      ModulusCLI::_dir(substr($controller, 0, strrpos($controller, DIRECTORY_SEPARATOR)));

      $namespace = substr($name, 0, strrpos($name, DIRECTORY_SEPARATOR));
      $name = str_replace($namespace . DIRECTORY_SEPARATOR, '', $name);

      $namespace = '\\' . str_replace('/', '\\', $namespace);
    }

    ModulusCLI::_dir($models);
    ModulusCLI::_dir($groups);
    ModulusCLI::_dir($controllers);

    switch ($type) {
      case 'model':
        if (file_exists($model)) {
          return false;
        }

        $modelcontent = str_replace('{model_name}', $name, $modelcontent);
        $modelcontent = str_replace('{namespace}', $namespace, $modelcontent);
        $groupcontent = str_replace('{model_name}', $name, $groupcontent);
        $groupcontent = str_replace('{namespace}', $namespace, $groupcontent);

        file_put_contents($model, $modelcontent);
        file_put_contents($group, $groupcontent);
        return true;
        break;

      case 'controller':
        if (file_exists($controller)) {
          return false;
        }

        $controllercontent = str_replace('{namespace}', $namespace, $controllercontent);
        $controllercontent = str_replace('{controller_name}', $name, $controllercontent);
        file_put_contents($controller, $controllercontent);

        $this->cleanController($controller, $namespace);

        return true;
        break;

      default:
        return true;
        break;
    }
  }
297969
public static function create($name, $type, $description = null)
    {
        $result = new static();
        $result->name = $name;
        $result->type = $type;
        $result->description = $description;

        return $result;
    }
1199247
public function addVar($name, $type = '', $description = '')
    {
        $this->var_types[$name] = $type == '' ? $type : $type.' ';
        $this->var_descriptions[$name] = $description;
        return $this;
    }
907164
public function addSimpleParameter(string $name, string $type = null, $defaultValue = null) {
		$parameter = new PhpParameter($name);
		$parameter->setType($type);

		if (2 < func_num_args()) {
			$parameter->setValue($defaultValue);
		}

		$this->addParameter($parameter);
		return $this;
	}
1025187
public function createElement($type, $name, $options = null) {
        $element = parent::createElement($type, $name, $options);
        return $element;
    }
1361556
public static function input( $name, $type = 'text' )
    {
        $elem = static::createElement($name,'input');
        $elem->attributes['type'] = $type;
        return $elem;
    }
354379
public function PhpWsdlParam($name,$type='string',$settings=null){
		PhpWsdl::Debug('New parameter '.$name);
		parent::PhpWsdlObject($name,$settings);
		$this->Type=$type;
	}
1106157
private function createOption($name, $type)
    {
        if (isset($this->mapping[$type][$name])) {
            $class = $this->mapping[$type][$name];
            $option = new $class();
        } elseif (class_exists($name)) {
            $option = new $name();
        } else {
            throw new OptionNotFoundException($name, $type);
        }

        if ($option instanceof OptionRegistryAwareInterface) {
            $option->setOptionRegistry($this);
        }

        return $option;
    }
623254
public function add($type = null)
    {
        $this->_validateActionIsEnabled('add');

        $this->_event('beforeAdd');

        $entity = $this->Model->newEntity()->accessible('*', true);
        if ($this->request->is('post')) {
            $entity = $this->Model->patchEntity($entity, $this->request->data());
            if ($this->Model->save($entity)) {
                $this->Flash->success(__d('CakeAdmin', 'The {0} has been saved.', [$this->type['singularAliasLc']]));
                return $this->redirect(['action' => 'index', 'type' => $this->type['name']]);
            } else {
                $this->Flash->error(__d('CakeAdmin', 'The {0} could not be saved. Please, try again.', [$this->type['singularAliasLc']]));
            }
        }

        $this->_loadAssociations();

        $this->set(compact('type', 'entity'));

        $this->_event('afterAdd');
    }
1081640
public function addColumn( $table, $name, $type )
    {
        return $this->handler->addColumn( $table, $name, $type );
    }
319214
public function PrimaryKey($Name, $Type = 'int') {
      $Column = $this->_CreateColumn($Name, $Type, FALSE, NULL, 'primary');
      $Column->AutoIncrement = TRUE;
      $this->_Columns[$Name] = $Column;
      
      return $this;
   }
1364765
public function addType($type)
    {
        if ($type instanceof Type) {
            $type = $type->getName();
        }

        if (!\is_string($type)) {
            throw new InvalidException('Invalid type type');
        }

        $this->_types[] = $type;

        return $this;
    }
300532
public function addType(Type $type, $name = '')
    {
        if (!$name) {
            $name = (string)$type;
        }

        $this->types[$name] = $type;
    }
590844
public static function getVariableType(string $name): string
    {
        self::loadData();
        $kbEntry = self::getVariable($name);
        if (isset($kbEntry->t)) {
            return Search::$data->varTypes->{$kbEntry->t};
        } else {
            throw new KBException("$name does have a known type !");
        }
    }