本文整理汇总了PHP中Phan\Language\FQSEN\FullyQualifiedMethodName::fromFullyQualifiedString方法的典型用法代码示例。如果您正苦于以下问题:PHP FullyQualifiedMethodName::fromFullyQualifiedString方法的具体用法?PHP FullyQualifiedMethodName::fromFullyQualifiedString怎么用?PHP FullyQualifiedMethodName::fromFullyQualifiedString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phan\Language\FQSEN\FullyQualifiedMethodName
的用法示例。
在下文中一共展示了FullyQualifiedMethodName::fromFullyQualifiedString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFullyQualifiedMethodName
public function testFullyQualifiedMethodName()
{
$this->assertFQSENEqual(FullyQualifiedMethodName::make(FullyQualifiedClassName::make('\\Name\\Space', 'a'), 'f'), '\\Name\\Space\\a::f');
$this->assertFQSENEqual(FullyQualifiedMethodName::fromFullyQualifiedString('\\Name\\a::f'), '\\Name\\a::f');
$this->assertFQSENEqual(FullyQualifiedMethodName::fromFullyQualifiedString('Name\\a::f'), '\\Name\\a::f');
$this->assertFQSENEqual(FullyQualifiedMethodName::fromFullyQualifiedString('\\Name\\Space\\a::f,2'), '\\Name\\Space\\a::f,2');
$this->assertFQSENEqual(FullyQualifiedMethodName::fromFullyQualifiedString('\\Name\\Space\\a,1::f,2'), '\\Name\\Space\\a,1::f,2');
$this->assertFQSENEqual(FullyQualifiedMethodName::fromStringInContext('a::methodName', $this->context), '\\a::methodname');
}
示例2: testSimple
public function testSimple()
{
$context = new Context();
$context_namespace = $context->withNamespace('\\A');
$context_class = $context_namespace->withClassFQSEN(FullyQualifiedClassName::fromFullyQualifiedString('\\A\\B'));
$context_method = $context_namespace->withMethodFQSEN(FullyQualifiedMethodName::fromFullyQualifiedString('\\A\\b::c'));
$this->assertTrue(!empty($context));
$this->assertTrue(!empty($context_namespace));
$this->assertTrue(!empty($context_class));
$this->assertTrue(!empty($context_method));
}
示例3: testSimple
public function testSimple()
{
$context = new Context();
$context_namespace = $context->withNamespace('\\A');
$context_class = $context_namespace->withScope(new ClassScope($context_namespace->getScope(), FullyQualifiedClassName::fromFullyQualifiedString('\\A\\B')));
$context_method = $context_namespace->withScope(new FunctionLikeScope($context_namespace->getScope(), FullyQualifiedMethodName::fromFullyQualifiedString('\\A\\b::c')));
$this->assertTrue(!empty($context));
$this->assertTrue(!empty($context_namespace));
$this->assertTrue(!empty($context_class));
$this->assertTrue(!empty($context_method));
}
示例4: createSchema
public static function createSchema() : Schema
{
$schema = new Schema('File', [new Column('file_path', Column::TYPE_STRING, true), new Column('modification_time', Column::TYPE_INT)]);
$schema->addAssociation(new ListAssociation('FileClassFQSEN', Column::TYPE_STRING, function (File $file, array $class_fqsen_string_list) {
$file->getFile()->setClassFQSENList(array_map(function (string $fqsen_string) {
return FullyQualifiedClassName::fromFullyQualifiedString($fqsen_string);
}, $class_fqsen_string_list));
}, function (File $file) {
return array_map(function (FullyQualifiedClassName $fqsen) {
return (string) $fqsen;
}, $file->getFile()->getClassFQSENList());
}));
$schema->addAssociation(new ListAssociation('FileMethodFQSEN', Column::TYPE_STRING, function (File $file, array $method_fqsen_string_list) {
$file->getFile()->setMethodFQSENList(array_map(function (string $fqsen_string) {
if (false !== strpos($fqsen_string, '::')) {
return FullyQualifiedMethodName::fromFullyQualifiedString($fqsen_string);
} else {
return FullyQualifiedFunctionName::fromFullyQualifiedString($fqsen_string);
}
}, $method_fqsen_string_list));
}, function (File $file) {
return array_map(function (FQSEN $fqsen) {
return (string) $fqsen;
}, $file->getFile()->getMethodFQSENList());
}));
$schema->addAssociation(new ListAssociation('FilePropertyFQSEN', Column::TYPE_STRING, function (File $file, array $fqsen_string_list) {
$file->getFile()->setPropertyFQSENList(array_map(function (string $fqsen_string) {
if (false !== strpos($fqsen_string, '::')) {
return FullyQualifiedPropertyName::fromFullyQualifiedString($fqsen_string);
} else {
return FullyQualifiedFunctionName::fromFullyQualifiedString($fqsen_string);
}
}, $fqsen_string_list));
}, function (File $file) {
return array_map(function (FQSEN $fqsen) {
return (string) $fqsen;
}, $file->getFile()->getPropertyFQSENList());
}));
$schema->addAssociation(new ListAssociation('FileConstantFQSEN', Column::TYPE_STRING, function (File $file, array $fqsen_string_list) {
$file->getFile()->setConstantFQSENList(array_map(function (string $fqsen_string) {
if (false !== strpos($fqsen_string, '::')) {
return FullyQualifiedConstantName::fromFullyQualifiedString($fqsen_string);
} else {
return FullyQualifiedFunctionName::fromFullyQualifiedString($fqsen_string);
}
}, $fqsen_string_list));
}, function (File $file) {
return array_map(function (FQSEN $fqsen) {
return (string) $fqsen;
}, $file->getFile()->getConstantFQSENList());
}));
return $schema;
}
示例5: unserialize
public function unserialize($serialized)
{
list($file_ref, $serialized) = explode('^', $serialized);
parent::unserialize($file_ref);
list($namespace, $is_conditional, $class_fqsen, $method_fqsen, $closure_fqsen) = explode('|', $serialized);
$this->namespace = $namespace;
$this->is_conditional = (bool) $is_conditional;
$this->class_fqsen = $class_fqsen ? FullyQualifiedClassName::fromFullyQualifiedString($class_fqsen) : null;
$this->method_fqsen = $method_fqsen ? FullyQualifiedMethodName::fromFullyQualifiedString($method_fqsen) : null;
$this->closure_fqsen = $closure_fqsen ? FullyQualifiedFunctionName::fromFullyQualifiedString($closure_fqsen) : null;
}
示例6: fromRow
/**
* @param array
* A map from column name to value
*
* @return Model
* An instance of the model derived from row data
*/
public static function fromRow(array $row) : Parameter
{
if (false !== strpos($row['method_fqsen'], '::')) {
$method_fqsen = FullyQualifiedMethodName::fromFullyQualifiedString($row['method_fqsen']);
} else {
$method_fqsen = FullyQualifiedFunctionName::fromFullyQualifiedString($row['method_fqsen']);
}
$primary_key_value = $row['id'] ?? null;
$parameter = new Parameter(new ParameterElement(unserialize(base64_decode($row['context'])), $row['name'], UnionType::fromFullyQualifiedString($row['type']), (int) $row['flags']), $method_fqsen, $primary_key_value);
return $parameter;
}
示例7: unserialize
/**
* @return void
*/
public function unserialize($serialized)
{
list($file_ref, $serialized) = explode('^', $serialized);
parent::unserialize($file_ref);
list($namespace, $class_fqsen, $method_fqsen, $closure_fqsen) = explode('|', $serialized);
$this->namespace = $namespace;
$this->class_fqsen = $class_fqsen ? FullyQualifiedClassName::fromFullyQualifiedString($class_fqsen) : null;
// Determine if we have a method or a function
if (false === strpos($method_fqsen, '::')) {
$this->method_fqsen = $method_fqsen ? FullyQualifiedFunctionName::fromFullyQualifiedString($method_fqsen) : null;
} else {
$this->method_fqsen = $method_fqsen ? FullyQualifiedMethodName::fromFullyQualifiedString($method_fqsen) : null;
}
$this->closure_fqsen = $closure_fqsen ? FullyQualifiedFunctionName::fromFullyQualifiedString($closure_fqsen) : null;
}
示例8: fromRow
/**
* @param array
* A map from column name to value
*
* @return Model
* An instance of the model derived from row data
*/
public static function fromRow(array $row) : Method
{
list($scope, $name) = explode('|', $row['scope_name']);
$method_element = new MethodElement(unserialize(base64_decode($row['context'])), $row['name'], UnionType::fromFullyQualifiedString($row['type']), (int) $row['flags']);
$method_element->setNumberOfRequiredParameters($row['number_of_required_parameters']);
$method_element->setNumberOfOptionalParameters($row['number_of_optional_parameters']);
$method = new Method($method_element, $scope, $name);
if (false !== strpos($row['fqsen'], '::')) {
$fqsen = FullyQualifiedMethodName::fromFullyQualifiedString($row['fqsen']);
} else {
$fqsen = FullyQualifiedFunctionName::fromFullyQualifiedString($row['fqsen']);
}
$method->getMethod()->setFQSEN($fqsen);
return $method;
}