Get a MODX reference to operate on.

@param \stdClass $profile An object describing properties of a MODX
instance.

@return \modX A reference to a MODX instance.
165680
public function &getMODX($profile)
    {
        if (!$this->modx instanceof \modX) {
            $results = $this->request->getResults();
            $this->modx = Teleport::instance()->getMODX($profile, $this->request->args(), $results);
        }
        return $this->modx;
    }
1352550
public static function get($version)
    {
        if (!isset(self::$profiles[$version])) {
            throw new ClientException("Unknown server profile: '$version'.");
        }

        $profile = self::$profiles[$version];

        return new $profile();
    }
947782
public function mapProfile($profile) {
        if (!$profile) return;

        $jskos = new Concept([
            'uri' => $profile->{'orcid-identifier'}->uri,
            'notation' => [ $profile->{'orcid-identifier'}->path ],
        ]);

        $bio = $profile->{'orcid-bio'};

        // names
        $details = $bio->{'personal-details'};

        $otherNames = [];
        $name = $details->{'given-names'}->value; # required

        if (isset($details->{'family-name'})) {
            $name = "$name " . $details->{'family-name'}->value;
        }

        if (isset($details->{'credit-name'})) {
            $creditName = $details->{'credit-name'}->value;
            if ($creditName != $name) {
                $otherNames[] = $name;
                $name = $creditName;
                # TODO: scopus id, researser ID etc.
            }
        }

        $jskos->prefLabel = ['en' => $name ];

        if (isset($details->{'other-names'})) {
            foreach ( $details->{'other-names'}->{'other-name'} as $otherName ) {
                if ($otherName->value != $name) {
                    $otherNames[] = $otherName->value;
                }
            }
        }

        $jskos->altLabel = ['en' => $otherNames];

        // biography
        if ($bio->biography && strtolower($bio->biography->visibility) == 'public') {
            $jskos->description['en'] = $bio->biography->value;
        }

        // external website links
        if ($bio->{'researcher-urls'}) {
            foreach ($bio->{'researcher-urls'}->{'researcher-url'} as $url) {
                $name = $url->{'url-name'}->value;
                $url  = $url->url->value;

                if (preg_match('/^https?:\/\/\w+\.wikipedia.org\/wiki\/.+/i', $url)) {
                    $jskos->subjectOf[] = new Concept([
                        "url" => $url
                    ]);
                    # TOOD: map to Wikidata URI
                } else { # TODO: detect more type of known URLs, for instance Twitter
                    $jskos->url = $url;
                }
            }
        }

        // contact details
        # TODO (email and address)

        // keywords
        if ($bio->keywords and $bio->keywords->keyword) {
            foreach ($bio->keywords->keyword as $keywords) {
                // often wrongly split by comma
                foreach (preg_split('/,\s*/', $keywords->value) as $keyword) {
                    $jskos->subject[] = new Concept([
                        "prefLabel" => [ "en" => $keyword ]
                    ]);
                }
            }
        }

        // external identifiers
        # TODO: scopus id, researser ID etc.

        return $jskos;
    }
856878
public function mapReference($alias)
    {
        //$alias = strval($alias);
        $reference = array_key_exists($alias, $this->aliases);

        if (array_key_exists($alias, $this->aliases)) {
            return $this->aliases[$alias];
        }

        return $alias;
    }
1221615
public function getProfiles(){
        if($this->loadProfiles != 'ALL'){
            $this->connection->select('name');
            $this->connection->from($this->tableProfile);
            $profiles= $this->connection->get()->fetchAll(\PDO::FETCH_ASSOC);
            foreach ($profiles as $profile) {
                $this->getProfile($profile['name']);
            }
            $this->loadModules= 'ALL';
        }
        return $this->profiles;
    }
1199451
public function getProfileSettings($profile)
    {
        $search = $this->repo->createSearch();
        $termQuery = new TermQuery('profile', $profile);
        $search->addQuery($termQuery);
        $search->setSize(1000);

        $settings = $this->repo->findArray($search);

        return $settings;
    }
398736
public function setResultCacheProfile(?QueryCacheProfile $profile = null)
    {
        if ($profile !== null && ! $profile->getResultCacheDriver()) {
            $resultCacheDriver = $this->em->getConfiguration()->getResultCacheImpl();
            $profile           = $profile->setResultCacheDriver($resultCacheDriver);
        }

        $this->queryCacheProfile = $profile;

        return $this;
    }
277616
public static function getConfiguration()
    {
        if (is_null(self::$_configuration)) {
            self::$_configuration = new stdClass();
            self::$_configuration->trigger = 'never';
            self::$_configuration->filters = new stdClass();

            $file = BP . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'aoe_profiler.xml';
            if (is_file($file)) {
                $conf = simplexml_load_file($file);
                if ($conf !== false) {
                    self::$_configuration->trigger = (string)$conf->aoe_profiler->trigger;
                    self::$_configuration->captureModelInfo = (bool)(string)$conf->aoe_profiler->captureModelInfo;
                    self::$_configuration->captureBacktraces = (bool)(string)$conf->aoe_profiler->captureBacktraces;
                    self::$_configuration->enableFilters = (bool)(string)$conf->aoe_profiler->enableFilters;
                    if (self::$_configuration->enableFilters) {
                        self::$_configuration->filters->sampling = (float)$conf->aoe_profiler->filters->sampling;
                        self::$_configuration->filters->timeThreshold = (int)$conf->aoe_profiler->filters->timeThreshold;
                        self::$_configuration->filters->memoryThreshold = (int)$conf->aoe_profiler->filters->memoryThreshold;
                        self::$_configuration->filters->requestUriWhiteList = (string)$conf->aoe_profiler->filters->requestUriWhiteList;
                        self::$_configuration->filters->requestUriBlackList = (string)$conf->aoe_profiler->filters->requestUriBlackList;
                    }
                }
            }
        }
        return self::$_configuration;
    }
108542
public static function profileName($project, $tenant, $profile)
    {
        return self::getProfileNameTemplate()->render([
            'project' => $project,
            'tenant' => $tenant,
            'profile' => $profile,
        ]);
    }
1308386
public function setAccessTokenFromProfile(TwitterProfile $profile)
    {
        $tokens = $profile->get(['access_token', 'access_token_secret']);

        if (!empty($tokens['access_token'])) {
            $this->app['twitter']->setTokens($tokens['access_token'], $tokens['access_token_secret']);
            $this->profile = $profile;
        } else {
            // use the access token from profile that referenced this profile
            $referencingProfile = $profile->relation('most_recently_referenced_by');

            // recursion would be nice here, but could be dangerous
            $tokens = $referencingProfile->get(['access_token', 'access_token_secret']);

            if ($referencingProfile->exists() && !empty($tokens['access_token'])) {
                $this->app['twitter']->setTokens($tokens['access_token'], $tokens['access_token_secret']);
                $this->profile = $referencingProfile;
            }
        }

        return $this;
    }
907963
protected static function consumeProfiledName(&$args, &$profile)
    {
        $profiledName          = new \stdClass();
        $profiledName->profile = $profile;

        // Get the first argument
        $arg = array_shift($args);

        // If it's not a scalar argument
        if (!is_scalar($arg)) {
            return self::consumeNonScalarProfiledName($arg, $profile);
        }

        if (($profile === false) && is_string(current($args))) {
            $profile = array_shift($args);
        }

        return self::createProfiledNameFromString(strval($arg), $profile);
    }
887086
public function getRefId($value)
    {
        foreach ($this->providers as $provider) {
            $ref = $provider->getRefId($value);

            if ($ref) {
                return $ref;
            }
        }

        return null;
    }
1361444
public static function hydrate(stdClass $profile)
    {
        $hydrated = new ProfileEntity();

        if (isset($profile->id)) {
            $hydrated->setId($profile->id);
        }

        if (isset($profile->name)) {
            $hydrated->setName($profile->name);
        }

        if (isset($profile->setting)) {
            $hydrated->setSetting(SettingHydrator::hydrate($profile->setting));
        }

        if (isset($profile->controllers) && is_array($profile->controllers)) {
            $hydrated->setControllers(ControllerHydrator::hydrateCollection($profile->controllers));
        }

        if (isset($profile->sources) && is_array($profile->sources)) {
            $hydrated->setSources(SourceHydrator::hydrateCollection($profile->sources));
        }

        if (isset($profile->sinks) && is_array($profile->sinks)) {
            $hydrated->setSinks(SinkHydrator::hydrateCollection($profile->sinks));
        }

        if (isset($profile->validators) && is_array($profile->validators)) {
            $hydrated->setValidators(ValidatorHydrator::hydrateCollection($profile->validators));
        }

        if (isset($profile->sanitizers) && is_array($profile->sanitizers)) {
            $hydrated->setSanitizers(SanitizerHydrator::hydrateCollection($profile->sanitizers));
        }

        if (isset($profile->ignored_codes) && is_array($profile->ignored_codes)) {
            $hydrated->setIgnoredCodes(IgnoredCodeHydrator::hydrateCollection($profile->ignored_codes));
        }

        if (isset($profile->ignored_locations) && is_array($profile->ignored_locations)) {
            $hydrated->setIgnoredLocations(IgnoredLocationHydrator::hydrateCollection($profile->ignored_locations));
        }

        if (isset($profile->extensions) && is_array($profile->extensions)) {
            $hydrated->setExtensions(ExtensionHydrator::hydrateCollection($profile->extensions));
        }

        if (isset($profile->application)) {
            $hydrated->setApplication(ApplicationHydrator::hydrate($profile->application));
        }

        if (isset($profile->created_by)) {
            $hydrated->setCreatedBy(UserHydrator::hydrate($profile->created_by));
        }

        if (isset($profile->default)) {
            $hydrated->setDefault($profile->default);
        }

        return $hydrated;
    }
930529
public function profiles()
    {
        if (is_null($this->profileRequests)) {
            $this->profileRequests = new ProfileRequests($this->client);
        }

        return $this->profileRequests;
    }
82996
public function indexAction(Profile $profile)
    {
        $weekView = $this->getRepo('HubWindowMaker')
            ->getWeekView($profile);

        return $this->render('HarvestCloudCoreBundle:Hub/WindowMaker:index.html.twig', array(
            'weekView' => $weekView,
            'profile'  => $profile,
        ));
    }
985176
public function addProfile($profile)
    {
        if (!array_key_exists('profileIds', $this->content)) {
            $this->content['profileIds'] = [];
        }

        $this->content['profileIds'][] = $this->extractProfileId($profile);

        return $this;
    }
657097
public function findProfile($profileId)
    {
        $application = $this->findOneBy(array('isDraft' => null, 'profiles._id' => new \MongoId($profileId)));
        foreach ($application->getProfiles() as $profile) {
            if ($profile->getId() == $profileId) {
                return $profile;
            }
        }
        return null;
    }