Get a human-readable name from a reflected callable.

@param \ReflectionFunctionAbstract $ref
@return string
339232
protected function getCallableName(\ReflectionFunctionAbstract $ref)
	{
		if($ref instanceof \ReflectionMethod)
		{
			return $ref->getDeclaringClass()->name . '->' . $ref->name . '()';
		}
		
		if($ref->isClosure())
		{
			return '*closure*';
		}
		
		return $ref->getName() . '()';
	}
127818
public function getName($quoted = false) {
		if (!$quoted) return $this->name;
		
		$quotedName = addcslashes($this->name, "\0..\37\177\\\"");
		// check if name needs to be quoted
		if ($this->name == $quotedName && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $this->name)) {
			return $this->name;
		} else {
			return mb_encode_mimeheader($quotedName, 'utf-8', 'Q', "\r\n");
			// return "\"{$quotedName}\"";
		}
	}
1369696
public function getNode($ref): ?Node
    {
        $nodeRef = $this->toNodeRef($ref);
        if (!$nodeRef instanceof NodeRef) {
            return null;
        }

        try {
            return $this->ncrCache->getNode($nodeRef);
        } catch (NodeNotFound $e) {
            return null;
        } catch (\Throwable $e) {
            if ($this->debug) {
                throw $e;
            }

            $this->logger->error(
                sprintf(
                    '%s::Unable to process twig "ncr_get_node" function for [{node_ref}].',
                    ClassUtils::getShortName($e)
                ),
                ['exception' => $e, 'node_ref' => (string)$nodeRef]
            );
        }

        return null;
    }
1047023
function getReference($table, $ref = null) {
		if (isset($this->references[$table])) {
			if (!strlen($ref)) {
				return current($this->references[$table]);
			}
			if (isset($this->references[$table][$ref])) {
				return $this->references[$table][$ref];
			}
		}
	}
474723
protected function getName()
    {
        // Check for different types of inline attachments.
        if ($this->_incomingObject->structure->ifdparameters) {
            foreach ($this->_incomingObject->structure->dparameters as $param) {
                if (strtolower($param->attribute) === 'filename') {
                    $this->name = $param->value;
                    break;
                }
            }
        } elseif ($this->_incomingObject->structure->ifparameters) {
            foreach ($this->_incomingObject->structure->parameters as $param) {
                if (strtolower($param->attribute) === 'name') {
                    $this->name = $param->value;
                    break;
                }
            }
        }
    }
1134597
public function getName($type)
    {
        $ref = new \ReflectionClass($this);
        foreach ($ref->getConstants() as $name => $value) {
            if ($value === $type) {
                return $name;
            }
        }

        throw new \InvalidArgumentException(sprintf('There is no token with value %s.', json_encode($type)));
    }
1235966
protected function getNameInput()
    {
        $name   = Str::studly($this->argument('name'));
        $suffix = $this->getNameSuffix();

        if ($suffix && !Str::endsWith($name, $suffix)) {
            $name .= $suffix;
        }

        return $name;
    }
433439
public function getName($autoGenerate = true)
    {
        if (!empty($this->_name)) {
            return $this->_name;
        }
        if ($autoGenerate) {
            $reflection = new \ReflectionClass($this);
            $this->_name = self::$autoNamePrefix . Inflector::variablize(
                    $reflection->getShortName()
                ) . self::$counter++;
        }
        return $this->_name;
    }
357733
private function convertReferenceToValue($reference)
    {
        if (is_scalar($reference)) {
            return $this->convertScalarReference($reference);
        } else {
            return $this->convertObjectReference($reference);
        }
    }
1283701
def get_definition_name_from_ref(ref):
        
        p = re.compile('#\/definitions\/(.*)')
        definition_name = re.sub(p, r'\1', ref)
        return definition_name
1245886
private static function prepareFunctionNames($refMethods)
    {
        $fieldNames = explode('.', $refMethods);

        $getters = [];
        foreach ($fieldNames as $field) {
            array_push($getters, 'get'.ucfirst($field));
        }

        return $getters;
    }
806178
public function resolve($reference)
    {
        if (!is_string($reference)) {
            return $reference;
        }
        $prefix = substr($reference, 0, 1);

        switch (1) {
            case $prefix    === '@'                                             : return $this->container->get(substr($reference, 1));
            case $prefix    === '%'                                             : return $this->container->getParameter(substr($reference, 1));
            case preg_match(static::CONTAINER_REGEXP, $reference, $matches)     : return $this->container;
            case preg_match(static::ENVIRONMENT_REGEXP, $reference, $matches)   : return getenv($matches[1]);
            case preg_match(static::CONSTANT_REGEXP, $reference, $matches)      : return constant($matches[1]);
            default                                                             : return $reference;
        }
    }
422241
private function customerNameA() {return dfc($this, function() {
		/** @var O $o */ $o = $this->o();
		/** @var OA $ba */ $ba = $this->addressB();
		/** @var C|DFCustomer $c */
		/** @var string|null $f */
		return ($f = $o->getCustomerFirstname()) ? [$f, $o->getCustomerLastname()] : (
			($c = $o->getCustomer()) && ($f = $c->getFirstname()) ? [$f, $c->getLastname()] : (
				$f = $ba->getFirstname() ? [$f, $ba->getLastname()] : (
					($sa = $this->addressS()) && ($f = $sa->getFirstname()) ? [$f, $sa->getLastname()] :
						[null, null]
				)
			)
		);
	});}
1197323
public static function getNameByConstant($constant)
    {
        switch ($constant) {
            case self::AUTHOR:
                return 'author';
            break;

            case self::CANDIDATE:
                return 'candidate';
            break;

            case self::PROCTOR:
                return 'proctor';
            break;

            case self::SCORER:
                return 'scorer';
            break;

            case self::TEST_CONSTRUCTOR:
                return 'testConstructor';
            break;

            case self::TUTOR:
                return 'tutor';
            break;

            default:
                return false;
            break;
        }
    }
713087
private function getReflection(callable $callable): \ReflectionFunctionAbstract
    {
        if (\is_array($callable)) {
            //The callable is checked by PHP in the constructor by the type hiting
            $reflectionClass = new \ReflectionClass($callable[0]);

            return $reflectionClass->getMethod($callable[1]);
        }

        if (\is_object($callable) && !$callable instanceof \Closure) {
            //It's not a closure, so it's mandatory a invokable object (because the callable is valid)
            $reflectionClass = new \ReflectionClass($callable);

            return $reflectionClass->getMethod('__invoke');
        }

        return new \ReflectionFunction($callable);
    }
426969
public function getName()
    {
        if (!$this->isEmpty($this->name)) {
            return $this->name;
        }

        foreach (['getName', 'getOriginalName'] as $fn) {
            $name = call_user_func([$this->event, $fn]);

            if ($this->isEmpty($name) || $name === $this) {
                continue;
            }

            if ($name instanceof self) {
                return $name = $name->getName();
            }
        }

        return $this->name = $this->parseEventName();
    }
714932
public function getName()
    {
        if ($this->_name === null) {
            $endpoint = namespaceSplit(get_class($this));
            $endpoint = substr(end($endpoint), 0, -8);

            $inflectMethod = $this->getInflectionMethod();
            $this->_name = Inflector::$inflectMethod($endpoint);
        }

        return $this->_name;
    }