GetID
@param XPath2Context $context
@param IContextProvider $provider
@param string $arg
@param XPathNavigator $node
@param bool $type False = ID, True - IDREF
@return string
514212
public static function GetID( $context, $provider, $arg, $node, $type )
	{
		if ( $arg instanceof Undefined )
		{
			throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::XPTY0004, array(
				"empty sequence",
				"xs:string",
			) );
		}

		if ( is_string( $arg ) )
		{
			if ( strlen( $arg ) == 0 )
			{
				return Undefined::getValue();
			}

			$arg = CoreFuncs::NormalizeSpace( $arg );
			// $arg = explode( " ", $arg );
			$arg = ExtFuncs::Tokenize( $arg, " " );
		}

		if ( ! $node instanceof XPathNavigator )
		{
			throw XPath2Exception::withErrorCodeAndParams( "XPTY0004", Resources::XPTY0004, array(
				"Node",
				SequenceType::WithTypeCode( SequenceType::GetXmlTypeCodeFromObject( $node ) ),
			) );
		}

		if ( ! $node->getIsNode() )
		{
			$x = 1;
		}

		$iter = XPath2NodeIterator::Create( $node );
		if ( ( $x = $iter->getCount() ) == 0 )
		{
			$x = 1;
		}

		if ( ! $node->MoveToRoot() )
		{
			$x = 1;
		}

		if ( $arg instanceof XPath2Item )
		{
			$arg = SingleIterator::Create( $arg );
		}

		// if ( strlen( $arg ) == 0 ) return Undefined::getValue();
		$iter = IDFilterNodeIterator::fromNodeTest( $context, $arg, $node, $type );
		return $iter;
	}
630384
private function get_context_courseid(\context $context) {

        if (empty($this->contextcourseids[$context->id])) {

            $coursecontext = $context->get_course_context(false);
            if (!$coursecontext) {
                // Default to the frontpage course context.
                $coursecontext = \context_course::instance(SITEID);
            }
            $this->contextcourseids[$context->id] = $coursecontext->instanceid;
        }

        return $this->contextcourseids[$context->id];
    }
1352062
public function Execute( $provider, $dataPool )
	{
		/**
		 * @var XPath2NodeIterator $iter
		 */
		$iter = XPath2NodeIterator::Create( $this->getAbstractNode(0)->Execute( $provider, $dataPool ) );
		for ( $k = 1; $k < $this->getCount(); $k++)
		{
			// $iter = new NodeIterator( $this->CreateEnumerator( $dataPool, $this->getAbstractNode( $k ), $iter ) );
			$node = $this->getAbstractNode( $k );
			$iter = new NodeIterator( function() use( $dataPool, $node, $iter ) { return $this->CreateEnumerator( $dataPool, $node, $iter ); } );
		}
		return $iter;
	}
378096
protected function getProvider(EventArgs $args)
    {
        $media = $this->getMedia($args);

        if (!$media instanceof MediaInterface) {
            return;
        }

        return $this->getPool()->getProvider($media->getProviderName());
    }
94563
private function getUpdatedResourceBinding(Args $args, ResourceBinding $bindingToUpdate)
    {
        $query = $bindingToUpdate->getQuery();
        $typeName = $bindingToUpdate->getTypeName();
        $language = $bindingToUpdate->getLanguage();
        $bindingParams = $bindingToUpdate->getParameterValues();

        if ($args->isOptionSet('query')) {
            $query = $args->getOption('query');
        }

        if ($args->isOptionSet('type')) {
            $typeName = $args->getOption('type');
        }

        if ($args->isOptionSet('language')) {
            $language = $args->getOption('language');
        }

        $this->parseParams($args, $bindingParams);
        $this->unsetParams($args, $bindingParams);

        return new ResourceBinding(
            Path::makeAbsolute($query, $this->currentPath),
            $typeName,
            $bindingParams,
            $language,
            $bindingToUpdate->getUuid()
        );
    }
1091098
public function getNodeFromContextPath($contextPath, Site $site = null, Domain $domain = null, $includeAll = false)
    {
        $nodePathAndContext = NodePaths::explodeContextPath($contextPath);
        $nodePath = $nodePathAndContext['nodePath'];
        $workspaceName = $nodePathAndContext['workspaceName'];
        $dimensions = $nodePathAndContext['dimensions'];

        $contextProperties = $this->prepareContextProperties($workspaceName, $dimensions);

        if ($site === null) {
            list(, , $siteNodeName) = explode('/', $nodePath);
            $site = $this->siteRepository->findOneByNodeName($siteNodeName);
        }

        if ($domain === null) {
            $domain = $this->domainRepository->findOneBySite($site);
        }

        $contextProperties['currentSite'] = $site;
        $contextProperties['currentDomain'] = $domain;
        if ($includeAll === true) {
            $contextProperties['invisibleContentShown'] = true;
            $contextProperties['removedContentShown'] = true;
        }

        $context = $this->contextFactory->create(
            $contextProperties
        );

        $workspace = $context->getWorkspace(false);
        if (!$workspace) {
            return new Error(
                sprintf('Could not convert the given source to Node object because the workspace "%s" as specified in the context node path does not exist.', $workspaceName), 1451392329);
        }

        return $context->getNode($nodePath);
    }
669519
public static String getPid(EvaluationCtx context) {
        EvaluationResult attribute
                = context.getResourceAttribute(STRING_ATTRIBUTE,
                        Constants.OBJECT.PID.attributeId,
                                               null);
        BagAttribute element = getAttributeFromEvaluationResult(attribute);
        if (element == null) {
            logger.debug("PolicyFinderModule:getPid exit on can't get pid on request callback");
            return null;
        }

        if (!(element.getType().equals(STRING_ATTRIBUTE))) {
            logger.debug("PolicyFinderModule:getPid exit on couldn't get pid from xacml request non-string returned");
            return null;
        }

        return (element.size() == 1) ? (String) element.getValue() : null;
    }
512788
private static function getInstanceAndNodeByType(string $instance, string $node, int $type): array
    {
        if (!empty($node)) {
            return [$instance, $node];
        }

        if ($type === self::RETURN_ROWS || $type === self::RETURN_INSERTID) {
            return [$instance, Pool::MASTER];
        }

        return [$instance, Pool::SLAVE];
    }
860046
def get_type_id(context, **kw):
    
    portal_type = kw.get("portal_type", None)
    if portal_type:
        return portal_type

    # Override by provided marker interface
    if IAnalysisRequestPartition.providedBy(context):
        return "AnalysisRequestPartition"
    elif IAnalysisRequestRetest.providedBy(context):
        return "AnalysisRequestRetest"
    elif IAnalysisRequestSecondary.providedBy(context):
        return "AnalysisRequestSecondary"

    return api.get_portal_type(context)
436569
public function serializeObjectToId(VisitorInterface $visitor, $data, array $type, Context $context)
    {
        $className = $this->manager->getClass();

        if ($data instanceof $className) {
            return $visitor->visitInteger($data->getId(), $type, $context);
        }
    }
842089
public function get( array $args = [], array $assoc_args = [] ) {

		$site_id = (int) $args[ 0 ];
		$site    = get_blog_details( $site_id );
		if ( ! $site ) {
			WP_CLI::error( "A site with ID {$site_id} does not exist" );
		}

		// trailing-slash it, as URLs ends always with a trailing slash in context of the wp_blogs table
		WP_CLI::line( trailingslashit( $site->siteurl ) );
		exit( 0 );
	}
126956
public static function get_nav_menu_id( $args ) {
		$args = (object) $args;
		$menu = wp_get_nav_menu_object( $args->menu );

		// Get the nav menu based on the theme_location
		if ( ! $menu
			&& $args->theme_location
			&& ( $locations = get_nav_menu_locations() )
			&& isset( $locations[ $args->theme_location ] )
		) {
			$menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] );
		}

		// get the first menu that has items if we still can't find a menu
		if ( ! $menu && ! $args->theme_location ) {
			$menus = wp_get_nav_menus();
			foreach ( $menus as $menu_maybe ) {
				if ( $menu_items = wp_get_nav_menu_items( $menu_maybe->term_id, array( 'update_post_term_cache' => false ) ) ) {
					$menu = $menu_maybe;
					break;
				}
			}
		}

		if ( is_object( $menu ) && ! is_wp_error( $menu ) ) {
			return $menu->term_id;
		} else {
			return false;
		}
	}
892381
public function Execute( $provider, $dataPool )
	{
		try
		{
			$value = CoreFuncs::CastToNumber1( $this->getContext(), CoreFuncs::Atomize( $this->getAbstractNode(0)->Execute( $provider, $dataPool ) ) );
			if ( ! $value instanceof Undefined )
				return call_user_func( $this->_unaryOper, $provider, $value );
			return Undefined::getValue();
		}
		catch ( DivideByZeroException $ex )
		{
			throw XPath2Exception::withErrorCode( "", $ex->getMessage(), $ex );
		}
		catch (\OverflowException $ex)
		{
			throw XPath2Exception::withErrorCode( "", $ex->getMessage(), $ex );
		}
	}
751301
protected function getType($context, $methodName, Node $node = null)
    {
        if ($this->isController($context)) {
            switch ($methodName) {
                case 'getDoctrine':
                    return 'Doctrine\Bundle\DoctrineBundle\Registry';
                case 'createForm':
                    return 'Symfony\Component\Form\Form';
                case 'createFormBuilder':
                    return 'Symfony\Component\Form\FormBuilder';
            }
        }

        if ('get' === $methodName && ($this->isController($context) || self::CONTAINER == $context)) {
            if ($node instanceof Node && isset($node->var)
                && ($node->var->name == 'this' || $node->var->name == 'container')
            ) {
                if ($node->args[0]->value instanceof Node\Scalar\String_) {
                    $serviceId = $node->args[0]->value->value;
                } elseif ($node->args[0]->value instanceof Node\Expr\Variable) {
                    // TODO: resolve variables
                }

                if (isset($serviceId) && $this->container->has($serviceId)) {
                    return $this->container->get($serviceId);
                }
            }

            return;
        }

        return;
    }
875167
public function get($id, $args = [])
    {
        // Fetch all the user properties by default, for convenience.
        if (! isset($args['field']) && ! isset($args['fields'])) {
            $args['fields'] = implode(
                ',',
                array(
                    'ID',
                    'user_login',
                    'display_name',
                    'user_email',
                    'user_registered',
                    'roles',
                    'user_pass',
                    'user_nicename',
                    'user_url',
                    'user_activation_key',
                    'user_status',
                    'url'
                )
            );
        }

        $wpcli_args = buildCLIArgs(
            array(
                'field',
                'fields',
            ),
            $args
        );

        array_unshift($wpcli_args, $id, '--format=json');
        $user = $this->drivers->getDriver()->wpcli('user', 'get', $wpcli_args)['stdout'];
        $user = json_decode($user);

        if (! $user) {
            throw new UnexpectedValueException(sprintf('[W504] Could not find user with ID %d', $id));
        }

        // Convert CSVs to arrays for consistency with WP-PHP driver.
        if (isset($user->roles) && ! is_array($user->roles)) {
            $user->roles = array_map('trim', explode(',', $user->roles));
        }

        return $user;
    }
733169
public static function getValidToken(
        ContextInterface $context,
        AccessToken $token = null,
        array $scopes = null,
        array $options = []
    ): AccessToken
	{
		if ($token === null || !$token->isValid()) {
            $token = AuthenticationHelper::getAccessToken($context, $scopes, $options);
		}

		return $token;
	}
1252150
public function select(string $type = null)
    {
        if (empty($type)) {
            $type = $this->provider;
        }

        $providers = $this->mergeProviders();
        if (!isset($providers[$type])) {
            throw new InvalidArgumentException(sprintf('Provider %s does not exist', $type));
        }

        $providerBeanName = $providers[$type];

        return App::getBean($providerBeanName);
    }