本文整理汇总了PHP中self::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP self::setName方法的具体用法?PHP self::setName怎么用?PHP self::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createSupportGroup
/**
* Wrapper for creating a support group.
* It will check if the support group doesn't exist yet, if the tag or name already exists then NAME_TAKEN or TAG_TAKEN will be returned.
* If the name is bigger than 20 characters or smaller than 4 and the tag greater than 7 or smaller than 2 a SIZE_ERROR will be returned.
* Else it will return SUCCESS
* @return a string that specifies if it was a success or not (SUCCESS, SIZE_ERROR, NAME_TAKEN or TAG_TAKEN )
*/
public static function createSupportGroup($name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password)
{
//error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
if (strlen($name) <= 21 && strlen($name) >= 4 && strlen($tag) <= 8 && strlen($tag) >= 2) {
$notExists = self::supportGroup_EntryNotExists($name, $tag);
//error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
if ($notExists == "SUCCESS") {
$sGroup = new self();
$values = array('Name' => $name, 'Tag' => $tag, 'GroupEmail' => $groupemail, 'IMAP_MailServer' => $imap_mailserver, 'IMAP_Username' => $imap_username, 'IMAP_Password' => $imap_password);
$sGroup->setName($values['Name']);
$sGroup->setTag($values['Tag']);
$sGroup->setGroupEmail($values['GroupEmail']);
$sGroup->setIMAP_MailServer($values['IMAP_MailServer']);
$sGroup->setIMAP_Username($values['IMAP_Username']);
//encrypt password!
global $cfg;
$crypter = new MyCrypt($cfg['crypt']);
$enc_password = $crypter->encrypt($values['IMAP_Password']);
$sGroup->setIMAP_Password($enc_password);
$sGroup->create();
//error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
} else {
//error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
//return NAME_TAKEN or TAG_TAKEN
return $notExists;
}
} else {
//error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
//RETURN ERROR that indicates SIZE
return "SIZE_ERROR";
}
}
示例2: createFromXML
/**
* @param SimpleXMLElement $xml
*
* @return Product
*/
public static function createFromXML(SimpleXMLElement $xml)
{
/*
<product default="true" name="bpack 24/7">
<price price20To30="750" price10To20="650" price5To10="550" price2To5="450" priceLessThan2="350" countryIso2Code="BE"/>
<option visiblity="NOT_VISIBLE_BY_CONSUMER_OPTIONAL" price="0" name="Saturday"/>
<option visiblity="NOT_VISIBLE_BY_CONSUMER_OPTIONAL" price="0" name="Info "Distributed""/>
<option visiblity="NOT_VISIBLE_BY_CONSUMER_OPTIONAL" price="0" name="Insurance"/>
</product>
*/
$attributes = $xml->attributes();
$children = $xml->children();
$product = new self();
$product->setDefault($attributes['default'] == 'true');
$product->setName($attributes['name']);
if (isset($children->price)) {
foreach ($children->price as $priceXml) {
$product->addPrice(Price::createFromXML($priceXml));
}
}
if (isset($children->option)) {
foreach ($children->option as $optionXml) {
$product->addOption(Option::createFromXML($optionXml));
}
}
return $product;
}
示例3: newInstance
public static function newInstance($name, $container)
{
$instance = new self();
$instance->setName($name);
$instance->setContainer($container);
return $instance;
}
示例4: fromReflection
/**
* fromReflection()
*
* @param Zend_Reflection_Property $reflectionProperty
* @return Zend_CodeGenerator_Php_Property
*/
public static function fromReflection(Zend_Reflection_Property $reflectionProperty)
{
$property = new self();
$property->setName($reflectionProperty->getName());
$allDefaultProperties = $reflectionProperty->getDeclaringClass()->getDefaultProperties();
$property->setDefaultValue($allDefaultProperties[$reflectionProperty->getName()]);
if ($reflectionProperty->getDocComment() != '') {
$property->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionProperty->getDocComment()));
}
if ($reflectionProperty->isStatic()) {
$property->setStatic(true);
}
if ($reflectionProperty->isPrivate()) {
$property->setVisibility(self::VISIBILITY_PRIVATE);
} elseif ($reflectionProperty->isProtected()) {
$property->setVisibility(self::VISIBILITY_PROTECTED);
} else {
$property->setVisibility(self::VISIBILITY_PUBLIC);
}
$property->setSourceDirty(false);
return $property;
}
示例5: fromReflection
/**
* fromReflection()
*
* @param MethodReflection $reflectionMethod
* @return MethodGenerator
*/
public static function fromReflection(MethodReflection $reflectionMethod)
{
$method = new self();
$method->setSourceContent($reflectionMethod->getContents(false));
$method->setSourceDirty(false);
if ($reflectionMethod->getDocComment() != '') {
$method->setDocBlock(DocBlockGenerator::fromReflection($reflectionMethod->getDocBlock()));
}
$method->setFinal($reflectionMethod->isFinal());
if ($reflectionMethod->isPrivate()) {
$method->setVisibility(self::VISIBILITY_PRIVATE);
} elseif ($reflectionMethod->isProtected()) {
$method->setVisibility(self::VISIBILITY_PROTECTED);
} else {
$method->setVisibility(self::VISIBILITY_PUBLIC);
}
$method->setStatic($reflectionMethod->isStatic());
$method->setName($reflectionMethod->getName());
foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
$method->setParameter(ParameterGenerator::fromReflection($reflectionParameter));
}
$method->setBody($reflectionMethod->getBody());
return $method;
}
示例6: fromReflection
public static function fromReflection(ZendL_Reflection_Class $reflectionClass)
{
$class = new self();
$class->setSourceContent($class->getSourceContent());
$class->setSourceDirty(false);
if ($reflectionClass->getDocComment() != '') {
$class->setDocblock(ZendL_Tool_CodeGenerator_Php_Docblock::fromReflection($reflectionClass->getDocblock()));
}
$class->setAbstract($reflectionClass->isAbstract());
$class->setName($reflectionClass->getName());
if ($parentClass = $reflectionClass->getParentClass()) {
$class->setExtendedClass($parentClass->getName());
}
$class->setImplementedInterfaces($reflectionClass->getInterfaceNames());
$properties = array();
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
if ($reflectionProperty->getDeclaringClass()->getName() == $class->getName()) {
$properties[] = ZendL_Tool_CodeGenerator_Php_Property::fromReflection($reflectionProperty);
}
}
$class->setProperties($properties);
$methods = array();
foreach ($reflectionClass->getMethods() as $reflectionMethod) {
if ($reflectionMethod->getDeclaringClass()->getName() == $class->getName()) {
$methods[] = ZendL_Tool_CodeGenerator_Php_Method::fromReflection($reflectionMethod);
}
}
$class->setMethods($methods);
return $class;
}
示例7: withAttributes
/**
* Creates a new Guild object with attributes
*
* @param $name string Name of the guild
* @param $banner string Banner of the guild
* @return Guild The newly created guild
*/
public static function withAttributes($name, $banner)
{
$instance = new self();
$instance->setName($name);
$instance->setBanner($banner);
return $instance;
}
示例8: fromReflection
public static function fromReflection(Zend_Reflection_Method $reflectionMethod)
{
$method = new self();
$method->setSourceContent($reflectionMethod->getContents(false));
$method->setSourceDirty(false);
if ($reflectionMethod->getDocComment() != '') {
$method->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionMethod->getDocblock()));
}
$method->setFinal($reflectionMethod->isFinal());
if ($reflectionMethod->isPrivate()) {
$method->setVisibility(self::VISIBILITY_PRIVATE);
} elseif ($reflectionMethod->isProtected()) {
$method->setVisibility(self::VISIBILITY_PROTECTED);
} else {
$method->setVisibility(self::VISIBILITY_PUBLIC);
}
$method->setStatic($reflectionMethod->isStatic());
$method->setName($reflectionMethod->getName());
foreach ($reflectionMethod->getParameters() as $reflectionParameter) {
$method->setParameter(Zend_CodeGenerator_Php_Parameter::fromReflection($reflectionParameter));
}
$body = $reflectionMethod->getBody();
$body2 = str_replace("\n\n", "\n", $body);
$body2 = preg_replace("|^\n\\s{4}|muU", "\n", $body2);
$body2 = preg_replace("|^\\s{4}|muU", "", $body2);
// $body2 = str_replace(' ', '.', $body2);
//dmDebug::kill($body, "\n".$body2);
$method->setBody($body2);
return $method;
}
示例9: __set_state
/**
* @param array $data
*
* @return Route
*/
public static function __set_state($data)
{
$route = new self($data['pattern'], $data['callback'], $data['args'], $data['requirements']);
if (isset($data['name'])) {
$route->setName($data['name']);
}
return $route;
}
示例10: fromReflection
/**
* fromReflection()
*
* @param Zend_Reflection_Docblock_Tag $reflectionTagReturn
* @return Zend_CodeGenerator_Php_Docblock_Tag_License
*/
public static function fromReflection(Zend_Reflection_Docblock_Tag $reflectionTagLicense)
{
$returnTag = new self();
$returnTag->setName('license');
$returnTag->setUrl($reflectionTagLicense->getUrl());
$returnTag->setDescription($reflectionTagLicense->getDescription());
return $returnTag;
}
示例11: initWithArray
public static function initWithArray($array)
{
$instance = new self(NULL, NULL, NULL);
$instance->setName($array[EventCategory::EVENTCATEGORY_NAME]);
$instance->setId($array[EventCategory::EVENTCATEGORY_ID]);
$instance->setPar_cat($array[EventCategory::EVENTCATEGORY_PAR_CAT]);
return $instance;
}
示例12: fromReflection
/**
* fromReflection()
*
* @param \Zend\Code\Reflection\ReflectionDocblockTag $reflectionTagReturn
* @return \Zend\Code\Generator\DocBlock\Tag\ReturnTag
*/
public static function fromReflection(\Zend\Code\Reflection\DocBlock\TagInterface $reflectionTagReturn)
{
$returnTag = new self();
$returnTag->setName('return');
$returnTag->setDatatype($reflectionTagReturn->getType());
// @todo rename
$returnTag->setDescription($reflectionTagReturn->getDescription());
return $returnTag;
}
示例13: fromReflection
/**
* fromReflection()
*
* @param Zend_Reflection_Docblock_Tag $reflectionTagReturn
* @return Zend_CodeGenerator_Php_Docblock_Tag_Return
*/
public static function fromReflection(Zend_Reflection_Docblock_Tag $reflectionTagReturn)
{
$returnTag = new self();
$returnTag->setName('return');
$returnTag->setDatatype($reflectionTagReturn->getType());
// @todo rename
$returnTag->setDescription($reflectionTagReturn->getDescription());
return $returnTag;
}
示例14: create
/**
* Criar Item com campos obrigatórios preenchidos
*
* @param string $id - Código do Produto
* @param string $name - Nome do Produto
* @param float $value - Valor Unitário
* @param integer $quantity - Quantidade
*
* @return Item
*/
public static function create($id, $name, $value, $quantity)
{
$instance = new self();
$instance->setId($id);
$instance->setName($name);
$instance->setValue($value);
$instance->setQuantity($quantity);
return $instance;
}
示例15: getByName
/**
* @param $name
* @return Model\Tool\CustomReport\Config
* @throws \Exception
*/
public static function getByName($name)
{
$code = new self();
$code->setName($name);
if (!$code->load()) {
throw new \Exception("sql report definition : " . $name . " does not exist");
}
return $code;
}