Get data type.

@param Client $client
@param string $href

@return array
509364
protected function getDataType(Client $client, $href)
    {
        $response = $client->get($href);
        $crawler = new Crawler($response->getBody()->__toString());

        $ancestors = [];
        $subclasses = $crawler->filter('[property="rdfs:subClassOf"]');
        if ($subclasses->count() > 0) {
            $ancestors[] = ltrim(preg_replace('/http[s]*:\/\/schema.org\//', '', $subclasses->first()->attr('href')), '/');
        }

        return [
            'ancestors' => $ancestors,
            'comment' => $crawler->filter('[property="rdfs:comment"]')->first()->text(),
            'comment_plain' => strip_tags($crawler->filter('[property="rdfs:comment"]')->first()->text()),
            'id' => $crawler->filter('[property="rdfs:label"]')->first()->text(),
            'label' => $crawler->filter('[property="rdfs:label"]')->first()->text(),
            'url' => $client->getConfig('base_uri').$href,
        ];
    }
1195898
private function identifyClientFromRequest()
  {
    $clientId   = $this->getRequest()->input('client_id', '');
    $clientSecret = $this->getRequest()->input('client_secret', null);
    $redirectUri  = $this->getRequest()->input('redirect_uri', null);

    try {
      $this->accessToken  = $this->getResource()->determineAccessToken();

      $sessionRepository = new FluentSession();
      $sesion      = $sessionRepository->validateAccessToken($this->accessToken);

      if ($sesion !== false) {
        $clientId   = $sesion['client_id'];
        $clientSecret = $sesion['client_secret'];
      }

      unset($sessionRepository);
      unset($sesion);
    } catch (InvalidAccessTokenException $e) {}

    if ( ! empty($clientId)) {
      $clientRepository = new FluentClient();
      $client       = $clientRepository->getClient($clientId, $clientSecret, $redirectUri);

      if ($client !== false) {
        $client['id']   = $clientId;
        $client['secret'] = $client['client_secret'];

        unset($client['client_id']);
        unset($client['client_secret']);
        unset($client['redirect_uri']);
        unset($client['metadata']);

        $this->client = new OauthClient();

        $this->client->fill($client);
        $this->client->exists = true;
        $this->client->syncOriginal();
      }

      unset($client);
      unset($clientRepository);
    }

    unset($clientId);
    unset($clientSecret);
    unset($redirectUri);
  }
1128640
def get_client_data(self, client):
        
        data = self._request('GET', '/clients/{}'.format(client))
        return data.json()
1321476
public function getArcroleTypes( $href = null )
	{
		if ( $href === null )
			return $this->arcroleTypes;
		else
		{
			$taxonomy = $this->getTaxonomyForXSD( $href );
			return ( $taxonomy === false )
				? false
				: $taxonomy->getArcroleTypes();
		}
	}
1094908
public function html($client=null)
	{
		$this->setRendered(true);
		$id = self::idPrefix.$this->id;
		$return  = '<div class="'.self::elementClass."\" id=\"{$id}_container\">";
		$return .= "<label for=\"".self::idPrefix."{$this->id}\">{$this->title}:</label>";
		$return .= "<div class=\"input\">";
		$return .= "<input type=\"file\" name=\"{$this->name}\" class=\"input-file\" ".
			"id=\"{$id}\" ".
			($this->readonly===true?'readonly="readonly" ':'').
			($this->disabled===true?'disabled="disabled" ':'').
			"/></div></div>";
		if(!is_null($client) and is_callable(array($this, $client)))
		{
			$return = $this->{$client}($return);
		}
		return $return;
	}
835626
private function deduceStatusCode($client): int
    {
        if ($client->errCode === 110) {
            $status = 404;
        } else {
            $status = $client->statusCode;
        }
        return $status > 0 ? $status : 500;
    }
871054
public function refreshContentTypeCache(Client $client): void
    {
        $spacePath = $this->getSpaceCachePath($client);
        $contentTypes = $client->getContentTypes();
        foreach ($contentTypes as $contentType) {
            $this->fileSystem->dumpFile($spacePath . '/ct-' . $contentType->getId() . '.json', (string) json_encode($contentType));
        }
    }
1273868
private function resolveClient($client)
	{
		$client = ! empty($client)
			? $client
			: new Client();

		$client->setBaseUrl(Properties::baseUrl())
			->setUserAgent('Double Opt-in php-api/' . self::VERSION);

		$httpClientConfig = $this->config->getHttpClientConfig();
		if (array_key_exists('verify', $httpClientConfig)
			&& $httpClientConfig['verify'] === false)
		{
			$client->setSslVerification(false, false);
		}

		return $client;
	}
731497
public function getClientMediaType() : string
    {
        return ($this->clientFilename === null) ? $this->fileStream->getMimeType() : $this->retrieveFileMimeType($this->clientFilename);
    }
648050
public function html($client=null)
	{
		$this->setRendered(true);
		$id = self::idPrefix.$this->id;
		$return  = '<div class="'.self::elementClass."\" id=\"{$id}_container\">";
		$return .= "<label for=\"{$id}\">{$this->title}:</label>";
		$return .= "<div class=\"input\">";
		$return .= "<div class=\"input-append\">";
		if(!empty($this->value))
		{
			$view = $this->value;
			$xView = true;
			if(is_array($this->source))
			{
				foreach($this->source as $item)
				{
					$item = (object) $item;
					if($item->id==$this->value)
					{
						$view = $item->label;
						$xView = true;
						break;
					}
				}
			}
			else
			{
				$proxy = $this->getContext()->getModel('Proxy');
				$response = $proxy->requestJson('admin/forms/selectables.json', HTTP_Request2::METHOD_GET, array(
					'field' => $this->id,
					'workflow' => AgaviConfig::get('Nosazin.workflow'),
					'filter' => array(
						'id' => $this->value
					)
				));
				if(is_object($response) and $response->success)
				{
					foreach($response->result as $item)
					{
						if($item->id==$this->value)
						{
							$view = $item->label;
							$xView = true;
							break;
						}
					}
				}
			}
			$return .= "<input type=\"text\" name=\"{$this->name}_view\" ".
				"id=\"{$id}_view\" value=\"{$view}\" ".
				($this->readonly===true?'readonly="readonly" ':'').
				($this->disabled===true?'disabled="disabled" ':'').
				"/>";
			$return .= "<input type=\"hidden\" name=\"{$this->name}\" ".
				"id=\"{$id}\" value=\"{$this->value}\" />";
		}
		else
			$return .= "<input type=\"text\" name=\"{$this->name}\" ".
				"id=\"{$id}\" value=\"{$this->value}\" ".
				($this->readonly===true?'readonly="readonly" ':'').
				($this->disabled===true?'disabled="disabled" ':'').
				"/>";
		$return .= "<label class=\"add-on\">↓</label>".
			"</div></div></div>";
		if(!is_null($client) and is_callable(array($this, $client)))
		{
			$return = $this->{$client}($return);
		}
		return $return;
	}
389887
public function checkClientCredentials($client_id, $client_secret = null)
    {
        $result = $this->client->getItem(array(
            "TableName"=> $this->config['client_table'],
            "Key" => array('client_id'   => array('S' => $client_id))
        ));

        return  $result->count()==1 && $result["Item"]["client_secret"]["S"] == $client_secret;
    }
125653
protected function authOpenId($client)
    {
        $request = Yii::$app->getRequest();
        $mode = $request->get('openid_mode', $request->post('openid_mode'));

        if (empty($mode)) {
            $url = $client->buildAuthUrl();
            return Yii::$app->getResponse()->redirect($url);
        }

        switch ($mode) {
            case 'id_res':
                if ($client->validate()) {
                    return $this->authSuccess($client);
                }
                throw new HttpException(400, 'Unable to complete the authentication because the required data was not received.');
            case 'cancel':
                return $this->authCancel($client);
            default:
                throw new HttpException(400);
        }
    }
1279373
public function getJsonSmd( $clientUrl )
	{
		$services = [];
		$transport = array( 'envelope' => 'JSON-RPC-2.0', 'transport' => 'POST' );

		foreach( $this->getControllers() as $controller )
		{
			foreach( $controller->getServiceDescription() as $method => $entry ) {
				$services[$method] = $entry + $transport;
			}
		}

		$smd = array(
			'transport' => 'POST',
			'envelope' => 'JSON-RPC-2.0',
			'contentType' => 'application/json',
			'SMDVersion' => '2.0',
			'target' => $clientUrl,
			'services' => $services,
		);

		if( ( $json = json_encode( $smd ) ) === null ) {
			throw new \RuntimeException( 'Unable to encode service mapping description to JSON' );
		}

		return $json;
	}
1088390
public function getTaxonomyForXSD( $href )
	{
		if ( is_string( $href ) && \XBRL::endsWith( $href, '.xsd' ) && \XBRL::startsWith( $href, 'http' ) )
		{
			if ( ! isset( $this->schemaFileToNamespace[ $href ] ) )
				return null;

			$xsd = $href;
		}
		else
		{
			$parts = is_array( $href ) ? $href : parse_url( $href );
			if ( ! isset( $parts['path'] ) ) return false;
			$xsd = pathinfo( $parts['path'], PATHINFO_BASENAME );
			if ( ! isset( $this->schemaFileToNamespace[ $xsd ] ) )
			{
				return false;
			}
		}

		$namespace = $this->schemaFileToNamespace[ $xsd ];
		if ( ! isset( $this->importedSchemas[ $namespace ] ) ) return false;

		return $this->importedSchemas[ $namespace ];
	}
681439
public function generateDataciteSymbol(Client $client)
    {
        $prefix = "ANDS.";
        $id = $client->client_id;

        // prefix before the
        if ($id < 100) {
            $prefix .= "CENTRE";
        }

        if ($id < 10) {
            $prefix .= "-";
        } elseif ($id >= 100) {
            // prefix before the ID (new form)
            $prefix .= "C";
        }

        $client->datacite_symbol = $prefix . $id;
        $client->save();

        return $client;
    }
354478
public function getApiEndPointFromApi($client)
    {
        $accountInfo = $client->getAccountInfo();
        $apiEndpoint = false;
        if (is_object($accountInfo) && !isset($accountInfo->message)) {
            //save endpoint for account
            foreach ($accountInfo->properties as $property) {
                if ($property->name == 'ApiEndpoint' && !empty($property->value)) {
                    $apiEndpoint = $property->value;
                    break;
                }
            }
        }
        return $apiEndpoint;
    }
496412
public static function mrr(array $options = [], ClientInterface $client = null)
    {
        return Metrics\MRRs::all($options, $client);
    }