本文整理汇总了PHP中self::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP self::getName方法的具体用法?PHP self::getName怎么用?PHP self::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: exec
public static final function exec($data)
{
$process = new self();
$process->run($data);
Log::info(' === ' . $process->getName() . ' ==== started === ');
return $process;
}
示例3: addChild
/**
* @param string|int|self $role
*/
public function addChild($role)
{
if (!$role instanceof self) {
$role = new self($role);
}
$this->children[$role->getName()] = $role;
}
示例4: getParentClass
public function getParentClass()
{
$parent = parent::getParentClass();
if ($parent) {
$parent = new self($parent->getName());
}
return $parent;
}
示例5: equals
/**
* @param Privilege|string $privilege
*
* @throws \InvalidArgumentException
*
* @return bool
*/
public function equals($privilege)
{
if (is_scalar($privilege)) {
$privilege = new self($privilege);
} elseif (!$privilege instanceof self) {
throw new \InvalidArgumentException('$privilege is expected to be of type string or Gobline\\Acl\\Privilege');
}
return $privilege->getName() === $this->name;
}
示例6: equals
/**
* {@inheritdoc}
*/
public function equals($role)
{
if (is_scalar($role)) {
$role = new self($role);
} elseif (!$role instanceof self) {
throw new \InvalidArgumentException('$role is expected to be of type string or Gobline\\Acl\\Role');
}
$roleName = $role->getName();
return $roleName === $this->name;
}
示例7: getFromRegularDonation
public static function getFromRegularDonation(Donator_Model_RegularDonation $regDon)
{
$obj = new self($regDon->__get('bank_account_nr'), $regDon->__get('account_name'), $regDon->__get('bank_name'), $regDon->__get('bank_code'), $regDon->getForeignId('donation_payment_method'));
$fundMaster = $regDon->getForeignRecord('fundmaster_id', Donator_Controller_FundMaster::getInstance());
$obj->setContactId($fundMaster->getForeignId('contact_id'));
$contact = $fundMaster->getForeignRecord('contact_id', Addressbook_Controller_Contact::getInstance());
$countryCode = $contact->getLetterDrawee()->getPostalAddress()->getCountryCode('DE');
$obj->setCountryCode($countryCode);
if (trim($obj->getName()) == '') {
$obj->setName($contact->__get('n_fileas'));
}
return $obj;
}
示例8: matches
/**
* {@inheritdoc}
*/
public function matches($resource)
{
if (!$resource instanceof self) {
if (is_scalar($resource)) {
$resource = new self($resource);
} elseif ($resource instanceof ResourceInterface) {
return false;
} else {
throw new \InvalidArgumentException('$resource is expected to be of type string or Gobline\\Acl\\ResourceInterface');
}
}
$resourceName = $resource->getName();
return $this->matcher->matches($resourceName, $this->name);
}
示例9: getInstanceFromXMLNodeObject
/**
* Function to get instance by using XML node
* @param <XML DOM> $extensionXMLNode
* @return <Settings_ModuleManager_Extension_Model> $extensionModel
*/
public static function getInstanceFromXMLNodeObject($extensionXMLNode)
{
$extensionModel = new self();
$objectProperties = get_object_vars($extensionXMLNode);
foreach ($objectProperties as $propertyName => $propertyValue) {
$propertyValue = (string) $propertyValue;
if ($propertyName === 'description') {
$propertyValue = nl2br(str_replace(array('<', '>'), array('<', '>'), br2nl(trim($propertyValue))));
}
$extensionModel->set($propertyName, $propertyValue);
}
$label = $extensionModel->get('label');
if (!$label) {
$extensionModel->set('label', $extensionModel->getName());
}
return $extensionModel;
}
示例10: initialize
/**
* @param \RokCommon_XMLElement $xml_node
*
* @throws \RokCommon_Config_Exception
*/
protected function initialize(RokCommon_XMLElement $xml_node)
{
$this->xml_node = $xml_node;
// get the name of the entry
if (!isset($this->xml_node['name'])) {
throw new RokCommon_Config_Exception(rc__('Meta Config entry in %s does not have a name', $this->parent_identifier));
}
$this->name = (string) $this->xml_node['name'];
// set the identifier name
$id_parts = explode(self::ENTRY_SEPERATOR, $this->parent_identifier);
$id_parts[] = $this->name;
$this->identifier = implode(self::ENTRY_SEPERATOR, $id_parts);
// get the filename of the entry
if (!isset($this->xml_node['filename'])) {
throw new RokCommon_Config_Exception(rc__('Meta Config entry %s does not have a filename', $this->identifier));
}
$this->filename = (string) $this->xml_node['filename'];
// get the mode
if (isset($this->xml_node['mode'])) {
$this->mode = (string) $this->xml_node['mode'];
}
// get the jointype
if (isset($this->xml_node['jointype'])) {
$this->jointype = (string) $this->xml_node['jointype'];
}
// see if there is a library and add it to the lib path
$library_paths = $xml_node->xpath('libraries/library');
if ($library_paths) {
foreach ($library_paths as $library_path) {
$resolved_lib_path = RokCommon_Config::replaceTokens((string) $library_path, dirname($this->root_file));
if (is_dir($resolved_lib_path)) {
RokCommon_ClassLoader::addPath($resolved_lib_path);
}
}
}
// get the paths for the config
$paths = $xml_node->xpath('paths/path');
if (!$paths) {
throw new RokCommon_Config_Exception(rc__('Meta Config entry %s must have at least one path.', $this->identifier));
}
foreach ($paths as $path_entry) {
$priority = RokCommon_Composite::DEFAULT_PRIORITY;
if (isset($path_entry['priority'])) {
$priority = (string) $path_entry['priority'];
}
$path = RokCommon_Config::replaceTokens((string) $path_entry, dirname($this->root_file));
if (is_dir($path)) {
// see if there is a testservice entry
if (isset($path_entry['testservice'])) {
// see if the testservice extists
$testservice_name = (string) $path_entry['testservice'];
$container = RokCommon_Service::getContainer();
/** @var $testservice RokCommon_Config_PathTest */
$testservice = $container->{$testservice_name};
if (!$container->hasService($testservice_name)) {
throw new RokCommon_Config_Exception(rc__('Path test service %s does not exist', $testservice_name));
}
// see if we can add the
if ($testservice->isPathAvailable()) {
$this->addPath($path, $priority);
}
} else {
// add the path if there is no testclass
$this->addPath($path, $priority);
}
} else {
// TODO log unable to find path
}
}
// add any subconfigs
$subconfigs = $xml_node->xpath('subconfigs/subconfig');
if ($subconfigs) {
foreach ($subconfigs as $subconfig_entry) {
$subconfig = new self($this->identifier, $this->root_file, $subconfig_entry);
$this->subentries[$subconfig->getName()] = $subconfig;
}
}
$this->context = RokCommon_Composite::get($this->identifier);
}
示例11: fromString
/**
* Generate a new Cookie object from a cookie string
* (for example the value of the Set-Cookie HTTP header)
*
* @static
* @throws Zend_Http_Header_Exception_InvalidArgumentException
* @param $headerLine
* @param bool $bypassHeaderFieldName
* @return array|SetCookie
*/
public static function fromString($headerLine, $bypassHeaderFieldName = false)
{
list($name, $value) = explode(': ', $headerLine, 2);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'set-cookie') {
throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid header line for Set-Cookie string: "' . $name . '"');
}
$multipleHeaders = preg_split('#(?<!Sun|Mon|Tue|Wed|Thu|Fri|Sat),\\s*#', $value);
$headers = array();
foreach ($multipleHeaders as $headerLine) {
$header = new self();
$keyValuePairs = preg_split('#;\\s*#', $headerLine);
foreach ($keyValuePairs as $keyValue) {
if (strpos($keyValue, '=')) {
list($headerKey, $headerValue) = preg_split('#=\\s*#', $keyValue, 2);
} else {
$headerKey = $keyValue;
$headerValue = null;
}
// First K=V pair is always the cookie name and value
if ($header->getName() === NULL) {
$header->setName($headerKey);
$header->setValue($headerValue);
continue;
}
// Process the remanining elements
switch (str_replace(array('-', '_'), '', strtolower($headerKey))) {
case 'expires':
$header->setExpires($headerValue);
break;
case 'domain':
$header->setDomain($headerValue);
break;
case 'path':
$header->setPath($headerValue);
break;
case 'secure':
$header->setSecure(true);
break;
case 'httponly':
$header->setHttponly(true);
break;
case 'version':
$header->setVersion((int) $headerValue);
break;
case 'maxage':
$header->setMaxAge((int) $headerValue);
break;
default:
// Intentionally omitted
}
}
$headers[] = $header;
}
return count($headers) == 1 ? array_pop($headers) : $headers;
}
示例12: fromReflection
/**
* fromReflection() - build a Code Generation Php Object from a Class Reflection
*
* @param \Zend\Reflection\ReflectionClass $reflectionClass
* @return \Zend\CodeGenerator\Php\PhpClass
*/
public static function fromReflection(\Zend\Reflection\ReflectionClass $reflectionClass)
{
$class = new self();
$class->setSourceContent($class->getSourceContent());
$class->setSourceDirty(false);
if ($reflectionClass->getDocComment() != '') {
$class->setDocblock(PhpDocblock::fromReflection($reflectionClass->getDocblock()));
}
$class->setAbstract($reflectionClass->isAbstract());
// set the namespace
if ($reflectionClass->inNamespace()) {
$class->setNamespaceName($reflectionClass->getNamespaceName());
}
$class->setName($reflectionClass->getName());
if ($parentClass = $reflectionClass->getParentClass()) {
$class->setExtendedClass($parentClass->getName());
$interfaces = array_diff($reflectionClass->getInterfaces(), $parentClass->getInterfaces());
} else {
$interfaces = $reflectionClass->getInterfaces();
}
$interfaceNames = array();
foreach($interfaces AS $interface) {
$interfaceNames[] = $interface->getName();
}
$class->setImplementedInterfaces($interfaceNames);
$properties = array();
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
if ($reflectionProperty->getDeclaringClass()->getName() == $class->getName()) {
$properties[] = PhpProperty::fromReflection($reflectionProperty);
}
}
$class->setProperties($properties);
$methods = array();
foreach ($reflectionClass->getMethods() as $reflectionMethod) {
if ($reflectionMethod->getDeclaringClass()->getName() == $class->getName()) {
$methods[] = PhpMethod::fromReflection($reflectionMethod);
}
}
$class->setMethods($methods);
return $class;
}
示例13: internalParse
/**
* @param array $option
* @param integer $currentXml
* @return array
*/
private function internalParse(array &$option, $currentXml = 0)
{
if ($currentXml == 0) {
if (!isset($option[0])) {
return array();
}
$currentXmlArray = $option[0];
$this->setName(isset($currentXmlArray['tag']) ? $currentXmlArray['tag'] : 'noname');
$this->setValue(isset($currentXmlArray['value']) ? $currentXmlArray['value'] : '');
$this->setAttributes(isset($currentXmlArray['attributes']) ? $currentXmlArray['attributes'] : array());
$this->setRoot(true);
}
$xmlArray = array();
$currentXml++;
$deep = $currentXml;
while ($deep < count($option)) {
$currentXmlArray = $option[$deep];
if ($currentXmlArray['type'] == 'close') {
return array($xmlArray, $deep);
}
$xmlObject = new self('');
$xmlObject->setName(isset($currentXmlArray['tag']) ? $currentXmlArray['tag'] : 'noname');
$xmlObject->setValue(isset($currentXmlArray['value']) ? $currentXmlArray['value'] : '');
$xmlObject->setAttributes(isset($currentXmlArray['attributes']) ? $currentXmlArray['attributes'] : array());
if ($currentXmlArray['type'] == 'open') {
$result = $this->internalParse($option, $deep++);
if (!empty($result)) {
list($children, $deep) = $result;
$xmlObject->appendChild($children);
}
}
$xmlArray[$xmlObject->getName()][] = $xmlObject;
$deep++;
}
return array($xmlArray, $deep);
}
示例14: array
public static function &getInstance($name = NULL)
{
static $instance = array();
if ($name === NULL) {
$keys = array_keys($instance);
$name = array_shift($keys);
}
if (!strlen($name)) {
$name = self::getDefaultLogger();
}
if (!isset($instance[$name])) {
$object = new self($name);
$name = $object->getName();
// If the instance already exists, we throw away the newly created one
// we can't safely do this before we create the object because it might be invalid and the
// test code for this is inside the class, so in this scenario, we just take a small hit
if (!isset($instance[$name])) {
$instance[$name] = $object;
}
if (!self::getDefaultLogger()) {
self::setDefaultLogger($name);
}
}
return $instance[$name];
}
示例15: getHTMLTableCellsForItem
/**
* @since version 0.84
*
* @param $row HTMLTableRow object (default NULL)
* @param $item CommonDBTM object (default NULL)
* @param $father HTMLTableCell object (default NULL)
* @param $options array
**/
static function getHTMLTableCellsForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
{
global $DB, $CFG_GLPI;
$column_name = __CLASS__;
if (isset($options['dont_display'][$column_name])) {
return;
}
if (empty($item)) {
if (empty($father)) {
return;
}
$item = $father->getItem();
}
$canedit = isset($options['canedit']) && $options['canedit'];
if ($item->getType() == 'NetworkPort_Vlan') {
if (isset($item->fields["tagged"]) && $item->fields["tagged"] == 1) {
$tagged_msg = __('Tagged');
} else {
$tagged_msg = __('Untagged');
}
$vlan = new self();
if ($vlan->getFromDB($options['items_id'])) {
$content = sprintf(__('%1$s - %2$s'), $vlan->getName(), $tagged_msg);
$content .= Html::showToolTip(sprintf(__('%1$s: %2$s'), __('ID TAG'), $vlan->fields['tag']) . "<br>" . sprintf(__('%1$s: %2$s'), __('Comments'), $vlan->fields['comment']), array('display' => false));
$this_cell = $row->addCell($row->getHeaderByName($column_name), $content, $father);
}
}
}