sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
private function hasFailed(TaskExecutionInterface $execution, \Exception $exception) { // this find is necessary because the storage could be // invalid (clear in doctrine) after handling an execution. $execution = $this->taskExecutionRepository->findByUuid($execution->getUuid()); $execution->setException($exception->__toString()); $execution->setStatus(TaskStatus::FAILED); $this->eventDispatcher->dispatch( Events::TASK_FAILED, new TaskExecutionEvent($execution->getTask(), $execution) ); return $execution; }
The given task failed the run. @param TaskExecutionInterface $execution @param \Exception $exception @return TaskExecutionInterface
entailment
private function finalize(TaskExecutionInterface $execution, $start) { // this find is necessary because the storage could be // invalid (clear in doctrine) after handling an execution. $execution = $this->taskExecutionRepository->findByUuid($execution->getUuid()); if ($execution->getStatus() !== TaskStatus::PLANNED) { $execution->setEndTime(new \DateTime()); $execution->setDuration(microtime(true) - $start); } $this->eventDispatcher->dispatch( Events::TASK_FINISHED, new TaskExecutionEvent($execution->getTask(), $execution) ); $this->taskExecutionRepository->save($execution); }
Finalizes given execution. @param TaskExecutionInterface $execution @param int $start
entailment
public function execute(TaskExecutionInterface $execution) { $handler = $this->handlerFactory->create($execution->getHandlerClass()); try { return $handler->handle($execution->getWorkload()); } catch (FailedException $exception) { throw $exception->getPrevious(); } catch (\Exception $exception) { if (!$handler instanceof RetryTaskHandlerInterface) { throw $exception; } throw new RetryException($handler->getMaximumAttempts(), $exception); } }
{@inheritdoc}
entailment
public function cacheMetrics($num = 1000, $page = 1) { if ($this->cached != null) { return $this->cached; } $this->cached = $this->client->call( 'GET', 'metrics', [ 'query' => [ 'per_page' => $num, 'current_page' => $page, ], ] ); return $this->cached; }
Cache Metrics for performance improvement. @param int $num @param int $page @return array|bool
entailment
public function indexMetrics($num = 1000, $page = 1) { if ($this->cache != false) { return $this->cacheMetrics($num, $page); } return $this->client->call( 'GET', 'metrics', [ 'query' => [ 'per_page' => $num, 'current_page' => $page, ], ] ); }
Get a defined number of Metrics. @param int $num @param int $page @return array|bool
entailment
public function searchMetrics($search, $by, $limit = 1, $num = 1000, $page = 1) { $metrics = $this->indexMetrics($num, $page)['data']; $filtered = array_filter( $metrics, function ($metric) use ($search, $by) { if (array_key_exists($by, $metric)) { if (strpos($metric[$by], $search) !== false) { return $metric; } if ($metric[$by] === $search) { return $metric; } } return false; } ); if ($limit == 1) { return array_shift($filtered); } return array_slice($filtered, 0, $limit); }
Search if a defined number of Metrics exists. @param string $search @param string $by @param int $num @param int $page @param int $limit @return mixed
entailment
private function loadFullDictionary(): void { $file = __DIR__ . '/../Dictionary/' . $this->language; if (!file_exists($file)) { $file = __DIR__ . '/../Dictionary/en_US'; } self::$dictionary = array_filter(explode(PHP_EOL, file_get_contents($file))); }
Load the current language dictionary with a lot of words to always be able to get a unique value.
entailment
public function getCharactersCharacterIdKillmailsRecentAsync($characterId, $datasource = 'tranquility', $maxCount = '50', $maxKillId = null, $token = null, $userAgent = null, $xUserAgent = null) { return $this->getCharactersCharacterIdKillmailsRecentAsyncWithHttpInfo($characterId, $datasource, $maxCount, $maxKillId, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getCharactersCharacterIdKillmailsRecentAsync Get character kills and losses @param int $characterId An EVE character ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $maxCount How many killmails to return at maximum (optional, default to 50) @param int $maxKillId Only return killmails with ID smaller than this. (optional) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function getCorporationsCorporationIdKillmailsRecent($corporationId, $datasource = 'tranquility', $maxKillId = null, $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getCorporationsCorporationIdKillmailsRecentWithHttpInfo($corporationId, $datasource, $maxKillId, $token, $userAgent, $xUserAgent); return $response; }
Operation getCorporationsCorporationIdKillmailsRecent Get corporation kills and losses @param int $corporationId An EVE corporation ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $maxKillId Only return killmails with ID smaller than this (optional) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return \nullx27\ESI\nullx27\ESI\Models\GetCorporationsCorporationIdKillmailsRecent200Ok[]
entailment
public function getCorporationsCorporationIdKillmailsRecentAsync($corporationId, $datasource = 'tranquility', $maxKillId = null, $token = null, $userAgent = null, $xUserAgent = null) { return $this->getCorporationsCorporationIdKillmailsRecentAsyncWithHttpInfo($corporationId, $datasource, $maxKillId, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getCorporationsCorporationIdKillmailsRecentAsync Get corporation kills and losses @param int $corporationId An EVE corporation ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $maxKillId Only return killmails with ID smaller than this (optional) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function getKillmailsKillmailIdKillmailHash($killmailHash, $killmailId, $datasource = 'tranquility', $userAgent = null, $xUserAgent = null) { list($response) = $this->getKillmailsKillmailIdKillmailHashWithHttpInfo($killmailHash, $killmailId, $datasource, $userAgent, $xUserAgent); return $response; }
Operation getKillmailsKillmailIdKillmailHash Get a single killmail @param string $killmailHash The killmail hash for verification (required) @param int $killmailId The killmail ID to be queried (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return \nullx27\ESI\nullx27\ESI\Models\GetKillmailsKillmailIdKillmailHashOk
entailment
public function getKillmailsKillmailIdKillmailHashAsync($killmailHash, $killmailId, $datasource = 'tranquility', $userAgent = null, $xUserAgent = null) { return $this->getKillmailsKillmailIdKillmailHashAsyncWithHttpInfo($killmailHash, $killmailId, $datasource, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getKillmailsKillmailIdKillmailHashAsync Get a single killmail @param string $killmailHash The killmail hash for verification (required) @param int $killmailId The killmail ID to be queried (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function setContactType($contactType) { $allowed_values = array('character', 'corporation', 'alliance', 'faction'); if ((!in_array($contactType, $allowed_values))) { throw new \InvalidArgumentException("Invalid value for 'contactType', must be one of 'character', 'corporation', 'alliance', 'faction'"); } $this->container['contactType'] = $contactType; return $this; }
Sets contactType @param string $contactType contact_type string @return $this
entailment
public function getAlliancesAllianceId($allianceId, $datasource = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getAlliancesAllianceIdWithHttpInfo($allianceId, $datasource, $userAgent, $xUserAgent); return $response; }
Operation getAlliancesAllianceId Get alliance information @param int $allianceId An Eve alliance ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @return \nullx27\ESI\Models\GetAlliancesAllianceIdOk
entailment
public function getAlliancesAllianceIdCorporations($allianceId, $datasource = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getAlliancesAllianceIdCorporationsWithHttpInfo($allianceId, $datasource, $userAgent, $xUserAgent); return $response; }
Operation getAlliancesAllianceIdCorporations List alliance's corporations @param int $allianceId An EVE alliance ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @return int[]
entailment
public function getAlliancesAllianceIdIcons($allianceId, $datasource = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getAlliancesAllianceIdIconsWithHttpInfo($allianceId, $datasource, $userAgent, $xUserAgent); return $response; }
Operation getAlliancesAllianceIdIcons Get alliance icon @param int $allianceId An EVE alliance ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @return \nullx27\ESI\Models\GetAlliancesAllianceIdIconsOk
entailment
public function __toArray() { $dto = array(); try { $reflectionClass = new \ReflectionClass($this); $properties = $reflectionClass->getProperties(\ReflectionProperty::IS_PUBLIC); if (count($properties) > 0) { /** @var \ReflectionProperty $property */ foreach ($properties as $property) { $value = $property->getValue($this); if(is_object($value) && method_exists($value, 'toArray')) { $dto[$property->getName()] = $value->toArray(); } elseif(is_array($value)) { foreach($value as &$arrValue) { if($arrValue instanceof Dto) { $arrValue = $arrValue->toArray(); } } $dto[$property->getName()] = $value; } else { $dto[$property->getName()] = $property->getValue($this); } } } } catch (\Exception $e) { Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR); } return $dto; }
Convert dto to array representation @return array
entailment
public function fromArray(array $object = array()) { if (count($object) > 0) { $reflector = new \ReflectionClass($this); $properties = InjectorHelper::extractProperties($reflector, \ReflectionProperty::IS_PUBLIC, InjectorHelper::VAR_PATTERN); unset($reflector); foreach ($object as $key => $value) { if (property_exists($this, $key) && null !== $value) { $this->parseDtoField($properties, $key, $value); } } } }
Hydrate object from array @param array $object
entailment
public static function addModelField(TableMap $tableMap, ModelCriteria &$query, $field, $value = null) { if ($column = self::checkFieldExists($tableMap, $field)) { self::addQueryFilter($column, $query, $value); } }
Method that adds the fields for the model into the API Query @param TableMap $tableMap @param ModelCriteria $query @param string $field @param mixed $value
entailment
public function createInstance($sid ,$token, $version = null, $retryAttempts = 1) { return new \Services_Twilio($sid, $token, $version, null, $retryAttempts); }
Returns a new \Services_Twilio instance from the given parameters @param $sid @param $token @param null $version @param int $retryAttempts @return \Services_Twilio
entailment
public function deleteCharactersCharacterIdContactsAsync($characterId, $contactIds, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->deleteCharactersCharacterIdContactsAsyncWithHttpInfo($characterId, $contactIds, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation deleteCharactersCharacterIdContactsAsync Delete contacts @param int $characterId An EVE character ID (required) @param int[] $contactIds A list of contacts to delete (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function deleteCharactersCharacterIdContactsAsyncWithHttpInfo($characterId, $contactIds, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { $returnType = ''; $request = $this->deleteCharactersCharacterIdContactsRequest($characterId, $contactIds, $datasource, $token, $userAgent, $xUserAgent); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } ); }
Operation deleteCharactersCharacterIdContactsAsyncWithHttpInfo Delete contacts @param int $characterId An EVE character ID (required) @param int[] $contactIds A list of contacts to delete (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function getAlliancesAllianceIdContacts($allianceId, $datasource = 'tranquility', $page = '1', $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getAlliancesAllianceIdContactsWithHttpInfo($allianceId, $datasource, $page, $token, $userAgent, $xUserAgent); return $response; }
Operation getAlliancesAllianceIdContacts Get alliance contacts @param int $allianceId An EVE alliance ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $page Which page of results to return (optional, default to 1) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return \nullx27\ESI\nullx27\ESI\Models\GetAlliancesAllianceIdContacts200Ok[]
entailment
public function getAlliancesAllianceIdContactsAsync($allianceId, $datasource = 'tranquility', $page = '1', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getAlliancesAllianceIdContactsAsyncWithHttpInfo($allianceId, $datasource, $page, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getAlliancesAllianceIdContactsAsync Get alliance contacts @param int $allianceId An EVE alliance ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $page Which page of results to return (optional, default to 1) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function getCharactersCharacterIdContactsAsync($characterId, $datasource = 'tranquility', $page = '1', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getCharactersCharacterIdContactsAsyncWithHttpInfo($characterId, $datasource, $page, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getCharactersCharacterIdContactsAsync Get contacts @param int $characterId An EVE character ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $page Which page of results to return (optional, default to 1) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function getCharactersCharacterIdContactsLabels($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getCharactersCharacterIdContactsLabelsWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent); return $response; }
Operation getCharactersCharacterIdContactsLabels Get contact labels @param int $characterId An EVE character ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return \nullx27\ESI\nullx27\ESI\Models\GetCharactersCharacterIdContactsLabels200Ok[]
entailment
public function getCharactersCharacterIdContactsLabelsAsync($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getCharactersCharacterIdContactsLabelsAsyncWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getCharactersCharacterIdContactsLabelsAsync Get contact labels @param int $characterId An EVE character ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function getCorporationsCorporationIdContacts($corporationId, $datasource = 'tranquility', $page = '1', $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getCorporationsCorporationIdContactsWithHttpInfo($corporationId, $datasource, $page, $token, $userAgent, $xUserAgent); return $response; }
Operation getCorporationsCorporationIdContacts Get corporation contacts @param int $corporationId An EVE corporation ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $page Which page of results to return (optional, default to 1) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return \nullx27\ESI\nullx27\ESI\Models\GetCorporationsCorporationIdContacts200Ok[]
entailment
public function getCorporationsCorporationIdContactsAsync($corporationId, $datasource = 'tranquility', $page = '1', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getCorporationsCorporationIdContactsAsyncWithHttpInfo($corporationId, $datasource, $page, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getCorporationsCorporationIdContactsAsync Get corporation contacts @param int $corporationId An EVE corporation ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $page Which page of results to return (optional, default to 1) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function postCharactersCharacterIdContacts($characterId, $contactIds, $standing, $datasource = 'tranquility', $labelId = '0', $token = null, $userAgent = null, $watched = 'false', $xUserAgent = null) { list($response) = $this->postCharactersCharacterIdContactsWithHttpInfo($characterId, $contactIds, $standing, $datasource, $labelId, $token, $userAgent, $watched, $xUserAgent); return $response; }
Operation postCharactersCharacterIdContacts Add contacts @param int $characterId An EVE character ID (required) @param int[] $contactIds A list of contacts to add (required) @param float $standing Standing for the new contact (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $labelId Add a custom label to the new contact (optional, default to 0) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param bool $watched Whether the new contact should be watched, note this is only effective on characters (optional, default to false) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return int[]
entailment
public function postCharactersCharacterIdContactsAsync($characterId, $contactIds, $standing, $datasource = 'tranquility', $labelId = '0', $token = null, $userAgent = null, $watched = 'false', $xUserAgent = null) { return $this->postCharactersCharacterIdContactsAsyncWithHttpInfo($characterId, $contactIds, $standing, $datasource, $labelId, $token, $userAgent, $watched, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation postCharactersCharacterIdContactsAsync Add contacts @param int $characterId An EVE character ID (required) @param int[] $contactIds A list of contacts to add (required) @param float $standing Standing for the new contact (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $labelId Add a custom label to the new contact (optional, default to 0) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param bool $watched Whether the new contact should be watched, note this is only effective on characters (optional, default to false) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function postCharactersCharacterIdContactsAsyncWithHttpInfo($characterId, $contactIds, $standing, $datasource = 'tranquility', $labelId = '0', $token = null, $userAgent = null, $watched = 'false', $xUserAgent = null) { $returnType = 'int[]'; $request = $this->postCharactersCharacterIdContactsRequest($characterId, $contactIds, $standing, $datasource, $labelId, $token, $userAgent, $watched, $xUserAgent); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { $responseBody = $response->getBody(); if ($returnType === '\SplFileObject') { $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); if ($returnType !== 'string') { $content = json_decode($content); } } return [ ObjectSerializer::deserialize($content, $returnType, []), $response->getStatusCode(), $response->getHeaders() ]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } ); }
Operation postCharactersCharacterIdContactsAsyncWithHttpInfo Add contacts @param int $characterId An EVE character ID (required) @param int[] $contactIds A list of contacts to add (required) @param float $standing Standing for the new contact (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $labelId Add a custom label to the new contact (optional, default to 0) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param bool $watched Whether the new contact should be watched, note this is only effective on characters (optional, default to false) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function putCharactersCharacterIdContactsAsync($characterId, $contactIds, $standing, $datasource = 'tranquility', $labelId = '0', $token = null, $userAgent = null, $watched = 'false', $xUserAgent = null) { return $this->putCharactersCharacterIdContactsAsyncWithHttpInfo($characterId, $contactIds, $standing, $datasource, $labelId, $token, $userAgent, $watched, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation putCharactersCharacterIdContactsAsync Edit contacts @param int $characterId An EVE character ID (required) @param int[] $contactIds A list of contacts to edit (required) @param float $standing Standing for the contact (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $labelId Add a custom label to the contact, use 0 for clearing label (optional, default to 0) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param bool $watched Whether the contact should be watched, note this is only effective on characters (optional, default to false) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function putCharactersCharacterIdContactsAsyncWithHttpInfo($characterId, $contactIds, $standing, $datasource = 'tranquility', $labelId = '0', $token = null, $userAgent = null, $watched = 'false', $xUserAgent = null) { $returnType = ''; $request = $this->putCharactersCharacterIdContactsRequest($characterId, $contactIds, $standing, $datasource, $labelId, $token, $userAgent, $watched, $xUserAgent); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); $statusCode = $response->getStatusCode(); throw new ApiException( sprintf( '[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri() ), $statusCode, $response->getHeaders(), $response->getBody() ); } ); }
Operation putCharactersCharacterIdContactsAsyncWithHttpInfo Edit contacts @param int $characterId An EVE character ID (required) @param int[] $contactIds A list of contacts to edit (required) @param float $standing Standing for the contact (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $labelId Add a custom label to the contact, use 0 for clearing label (optional, default to 0) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param bool $watched Whether the contact should be watched, note this is only effective on characters (optional, default to false) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function setCompany($company): Hybrid { self::validateSetLength('company', $company); $this->data['company'] = $company; return $this; }
@param string $company @return self
entailment
public function setSalutation($salutation): Hybrid { self::validateSetLength('salutation', $salutation); $this->data['salutation'] = $salutation; return $this; }
@param string $salutation @return self
entailment
public function setTitle($title): Hybrid { self::validateSetLength('title', $title); $this->data['title'] = $title; return $this; }
@param string $title @return self
entailment
public function setFirstName($firstName): Hybrid { self::validateSetLength('firstName', $firstName); $this->data['firstName'] = $firstName; return $this; }
@param string $firstName @return self
entailment
public function setLastName($lastName): Hybrid { self::validateSetLength('lastName', $lastName); $this->data['lastName'] = $lastName; return $this; }
@param string $lastName @return self
entailment
public function setStreetName($streetName): Hybrid { self::validateSetLength('streetName', $streetName); $this->data['streetName'] = $streetName; return $this; }
@param string $streetName @return self
entailment
public function setHouseNumber($houseNumber): Hybrid { self::validateSetLength('houseNumber', $houseNumber); $this->data['houseNumber'] = $houseNumber; return $this; }
@param string $houseNumber @return self
entailment
public function setAddressAddOn($addressAddOn): Hybrid { self::validateSetLength('addressAddOn', $addressAddOn); $this->data['addressAddOn'] = $addressAddOn; return $this; }
@param string $addressAddOn @return self
entailment
public function setPostOfficeBox($postOfficeBox): Hybrid { self::validateSetLength('postOfficeBox', $postOfficeBox); $this->data['postOfficeBox'] = $postOfficeBox; return $this; }
@param string $postOfficeBox @return self
entailment
public function setZipCode($zipCode): Hybrid { self::validateSetLength('zipCode', $zipCode); $this->data['zipCode'] = $zipCode; return $this; }
@param string $zipCode @return self
entailment
public function setCity($city): Hybrid { self::validateSetLength('city', $city); $this->data['city'] = $city; return $this; }
@param string $city @@return self
entailment
function jsonSerialize() { if ((null === $this->getStreetName() && null === $this->getPostOfficeBox()) || null === $this->getZipCode()) { throw new InvalidRecipientDataException( 'A (street name or post office box) and zip code must be set at least' ); } if (null !== $this->getStreetName() && null !== $this->getPostOfficeBox()) { throw new InvalidRecipientDataException('It must not be set a street name AND post office box'); } return parent::jsonSerialize(); }
{@inheritdoc} @throws InvalidRecipientDataException
entailment
public function setResponse($response) { $allowed_values = array('accepted', 'declined', 'tentative'); if ((!in_array($response, $allowed_values))) { throw new \InvalidArgumentException("Invalid value for 'response', must be one of 'accepted', 'declined', 'tentative'"); } $this->container['response'] = $response; return $this; }
Sets response @param string $response response string @return $this
entailment
public function setFromType($fromType) { $allowed_values = array('agent', 'npc_corp', 'faction'); if ((!in_array($fromType, $allowed_values))) { throw new \InvalidArgumentException("Invalid value for 'fromType', must be one of 'agent', 'npc_corp', 'faction'"); } $this->container['fromType'] = $fromType; return $this; }
Sets fromType @param string $fromType from_type string @return $this
entailment
public function setStanding($standing) { if (($standing > 10)) { throw new \InvalidArgumentException('invalid value for $standing when calling GetCharactersCharacterIdStandings200Ok., must be smaller than or equal to 10.'); } if (($standing < -10)) { throw new \InvalidArgumentException('invalid value for $standing when calling GetCharactersCharacterIdStandings200Ok., must be bigger than or equal to -10.'); } $this->container['standing'] = $standing; return $this; }
Sets standing @param float $standing standing number @return $this
entailment
public static function checkFieldExists(TableMap $tableMap, $field) { $column = null; try { foreach($tableMap->getColumns() as $tableMapColumn) { $columnName = $tableMapColumn->getPhpName(); if(preg_match('/^'.$field.'$/i', $columnName)) { $column = $tableMapColumn; break; } } } catch (\Exception $e) { Logger::log($e->getMessage(), LOG_DEBUG); } return $column; }
Check if parametrized field exists in api model @param TableMap $tableMap @param $field @return \Propel\Runtime\Map\ColumnMap|null
entailment
public function getStateAllowableValues() { return [ self::STATE_OPEN, self::STATE_CLOSED, self::STATE_EXPIRED, self::STATE_CANCELLED, self::STATE_PENDING, self::STATE_CHARACTER_DELETED, ]; }
Gets allowable values of the enum @return string[]
entailment
private static function extractAction($doc) { $action = null; if (false !== preg_match('/@action\s+([^\s]+)/', $doc, $matches)) { if(count($matches) > 1) { list(, $action) = $matches; } } return $action; }
Method that extract the instance of the class @param $doc @return null|string
entailment
public function find() { $runTime = new \DateTime(); $skippedExecutions = []; while ($execution = $this->taskExecutionRepository->findNextScheduled($runTime, $skippedExecutions)) { $handler = $this->taskHandlerFactory->create($execution->getHandlerClass()); if (!$handler instanceof LockingTaskHandlerInterface) { yield $execution; continue; } $key = $handler->getLockKey($execution->getWorkload()); if ($this->lock->isAcquired($key) || !$this->lock->acquire($key)) { $skippedExecutions[] = $execution->getUuid(); $this->logger->warning(sprintf('Execution "%s" is locked and skipped.', $execution->getUuid())); continue; } yield $execution; $this->lock->release($key); } }
{@inheritdoc}
entailment
public function listInvalidProperties() { $invalidProperties = []; if ($this->container['fuelBayView'] === null) { $invalidProperties[] = "'fuelBayView' can't be null"; } $allowedValues = $this->getFuelBayViewAllowableValues(); if (!in_array($this->container['fuelBayView'], $allowedValues)) { $invalidProperties[] = sprintf( "invalid value for 'fuelBayView', must be one of '%s'", implode("', '", $allowedValues) ); } if ($this->container['fuelBayTake'] === null) { $invalidProperties[] = "'fuelBayTake' can't be null"; } $allowedValues = $this->getFuelBayTakeAllowableValues(); if (!in_array($this->container['fuelBayTake'], $allowedValues)) { $invalidProperties[] = sprintf( "invalid value for 'fuelBayTake', must be one of '%s'", implode("', '", $allowedValues) ); } if ($this->container['anchor'] === null) { $invalidProperties[] = "'anchor' can't be null"; } $allowedValues = $this->getAnchorAllowableValues(); if (!in_array($this->container['anchor'], $allowedValues)) { $invalidProperties[] = sprintf( "invalid value for 'anchor', must be one of '%s'", implode("', '", $allowedValues) ); } if ($this->container['unanchor'] === null) { $invalidProperties[] = "'unanchor' can't be null"; } $allowedValues = $this->getUnanchorAllowableValues(); if (!in_array($this->container['unanchor'], $allowedValues)) { $invalidProperties[] = sprintf( "invalid value for 'unanchor', must be one of '%s'", implode("', '", $allowedValues) ); } if ($this->container['online'] === null) { $invalidProperties[] = "'online' can't be null"; } $allowedValues = $this->getOnlineAllowableValues(); if (!in_array($this->container['online'], $allowedValues)) { $invalidProperties[] = sprintf( "invalid value for 'online', must be one of '%s'", implode("', '", $allowedValues) ); } if ($this->container['offline'] === null) { $invalidProperties[] = "'offline' can't be null"; } $allowedValues = $this->getOfflineAllowableValues(); if (!in_array($this->container['offline'], $allowedValues)) { $invalidProperties[] = sprintf( "invalid value for 'offline', must be one of '%s'", implode("', '", $allowedValues) ); } if ($this->container['allowCorporationMembers'] === null) { $invalidProperties[] = "'allowCorporationMembers' can't be null"; } if ($this->container['allowAllianceMembers'] === null) { $invalidProperties[] = "'allowAllianceMembers' can't be null"; } if ($this->container['useAllianceStandings'] === null) { $invalidProperties[] = "'useAllianceStandings' can't be null"; } if ($this->container['attackIfOtherSecurityStatusDropping'] === null) { $invalidProperties[] = "'attackIfOtherSecurityStatusDropping' can't be null"; } if ($this->container['attackIfAtWar'] === null) { $invalidProperties[] = "'attackIfAtWar' can't be null"; } return $invalidProperties; }
Show all the invalid properties with reasons. @return array invalid properties with reasons
entailment
public function valid() { if ($this->container['fuelBayView'] === null) { return false; } $allowedValues = $this->getFuelBayViewAllowableValues(); if (!in_array($this->container['fuelBayView'], $allowedValues)) { return false; } if ($this->container['fuelBayTake'] === null) { return false; } $allowedValues = $this->getFuelBayTakeAllowableValues(); if (!in_array($this->container['fuelBayTake'], $allowedValues)) { return false; } if ($this->container['anchor'] === null) { return false; } $allowedValues = $this->getAnchorAllowableValues(); if (!in_array($this->container['anchor'], $allowedValues)) { return false; } if ($this->container['unanchor'] === null) { return false; } $allowedValues = $this->getUnanchorAllowableValues(); if (!in_array($this->container['unanchor'], $allowedValues)) { return false; } if ($this->container['online'] === null) { return false; } $allowedValues = $this->getOnlineAllowableValues(); if (!in_array($this->container['online'], $allowedValues)) { return false; } if ($this->container['offline'] === null) { return false; } $allowedValues = $this->getOfflineAllowableValues(); if (!in_array($this->container['offline'], $allowedValues)) { return false; } if ($this->container['allowCorporationMembers'] === null) { return false; } if ($this->container['allowAllianceMembers'] === null) { return false; } if ($this->container['useAllianceStandings'] === null) { return false; } if ($this->container['attackIfOtherSecurityStatusDropping'] === null) { return false; } if ($this->container['attackIfAtWar'] === null) { return false; } return true; }
Validate all the properties in the model return true if all passed @return bool True if all properties are valid
entailment
public function setFuelBayView($fuelBayView) { $allowedValues = $this->getFuelBayViewAllowableValues(); if (!in_array($fuelBayView, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'fuelBayView', must be one of '%s'", implode("', '", $allowedValues) ) ); } $this->container['fuelBayView'] = $fuelBayView; return $this; }
Sets fuelBayView @param string $fuelBayView Who can view the starbase (POS)'s fule bay. Characters either need to have required role or belong to the starbase (POS) owner's corporation or alliance, as described by the enum, all other access settings follows the same scheme @return $this
entailment
public function setFuelBayTake($fuelBayTake) { $allowedValues = $this->getFuelBayTakeAllowableValues(); if (!in_array($fuelBayTake, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'fuelBayTake', must be one of '%s'", implode("', '", $allowedValues) ) ); } $this->container['fuelBayTake'] = $fuelBayTake; return $this; }
Sets fuelBayTake @param string $fuelBayTake Who can take fuel blocks out of the starbase (POS)'s fuel bay @return $this
entailment
public function setAnchor($anchor) { $allowedValues = $this->getAnchorAllowableValues(); if (!in_array($anchor, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'anchor', must be one of '%s'", implode("', '", $allowedValues) ) ); } $this->container['anchor'] = $anchor; return $this; }
Sets anchor @param string $anchor Who can anchor starbase (POS) and its structures @return $this
entailment
public function setUnanchor($unanchor) { $allowedValues = $this->getUnanchorAllowableValues(); if (!in_array($unanchor, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'unanchor', must be one of '%s'", implode("', '", $allowedValues) ) ); } $this->container['unanchor'] = $unanchor; return $this; }
Sets unanchor @param string $unanchor Who can unanchor starbase (POS) and its structures @return $this
entailment
public function setOnline($online) { $allowedValues = $this->getOnlineAllowableValues(); if (!in_array($online, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'online', must be one of '%s'", implode("', '", $allowedValues) ) ); } $this->container['online'] = $online; return $this; }
Sets online @param string $online Who can online starbase (POS) and its structures @return $this
entailment
public function setOffline($offline) { $allowedValues = $this->getOfflineAllowableValues(); if (!in_array($offline, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'offline', must be one of '%s'", implode("', '", $allowedValues) ) ); } $this->container['offline'] = $offline; return $this; }
Sets offline @param string $offline Who can offline starbase (POS) and its structures @return $this
entailment
public function adminLogin($route = null) { if ($this->isAdmin()) { return $this->redirect('admin'); } else { return Admin::staticAdminLogon($route); } }
Acción que pinta un formulario genérico de login pra la zona restringida @param string $route @GET @route /admin/login @visible false @return string HTML
entailment
public function postLogin($route = null) { $form = new LoginForm(); $form->setData(array("route" => $route)); $form->build(); $tpl = Template::getInstance(); $tpl->setPublicZone(true); $template = "login.html.twig"; $params = array( 'form' => $form, ); $cookies = array(); $form->hydrate(); if ($form->isValid()) { if (Security::getInstance()->checkAdmin($form->getFieldValue("user"), $form->getFieldValue("pass"))) { $cookies = array( array( "name" => Security::getInstance()->getHash(), "value" => base64_encode($form->getFieldValue("user") . ":" . $form->getFieldValue("pass")), "expire" => time() + 3600, "http" => true, ) ); $template = "redirect.html.twig"; $params = array( 'route' => $form->getFieldValue("route"), 'status_message' => t("Acceso permitido... redirigiendo!!"), 'delay' => 1, ); } else { $form->setError("user", t("El usuario no tiene acceso a la web")); } } return $tpl->render($template, $params, $cookies); }
Servicio que valida el login @param null $route @POST @visible false @route /admin/login @return string @throws \PSFS\base\exception\FormException
entailment
private function genCrfsToken() { $hashOrig = ''; if (!empty($this->fields)) { foreach (array_keys($this->fields) as $field) { if ($field !== self::SEPARATOR) { $hashOrig .= $field; } } } if ('' !== $hashOrig) { $this->crfs = sha1($hashOrig); $this->add($this->getName() . '_token', array( 'type' => 'hidden', 'value' => $this->crfs, )); } return $this; }
Método que genera un CRFS token para los formularios @return Form
entailment
public function toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayError = true) { $strClass = (! empty($this->__class)) ? " class=\"{$this->__class} vf__page\"" : "class=\"vf__page\""; $strStyle = (! empty($this->__style)) ? " style=\"{$this->__style}\"" : ""; $strId = " id=\"{$this->__id}\""; $strOutput = "<div {$strClass}{$strStyle}{$strId}>\n"; if (! empty($this->__header)) { $strOutput .= "<h2>{$this->__header}</h2>\n"; } if (! $this->__isOverview) { foreach ($this->__elements as $field) { $strOutput .= $field->toHtml($submitted, $blnSimpleLayout, $blnLabel, $blnDisplayError); } } $strOutput .= "</div>\n"; return $strOutput; }
Generate HTML See {@link \ValidFormBuilder\ValidForm::toHtml()} @return string
entailment
public function addField($objField) { if (get_class($objField) == "ValidFormBuilder\\Fieldset") { $objField->setMeta("parent", $this, true); $this->__elements->addObject($objField); } else { if ($this->__elements->count() == 0) { $objFieldset = new Fieldset(); $this->__elements->addObject($objFieldset); } $objFieldset = $this->__elements->getLast(); $objField->setMeta("parent", $objFieldset, true); $objFieldset->getFields()->addObject($objField); if ($objField->isDynamic() && get_class($objField) !== "ValidFormBuilder\\MultiField" && get_class($objField) !== "ValidFormBuilder\\Area") { $objHidden = new Hidden($objField->getId() . "_dynamic", ValidForm::VFORM_INTEGER, array( "default" => 0, "dynamicCounter" => true )); $objFieldset->addField($objHidden); $objField->setDynamicCounter($objHidden); } } }
Add a field object See {@link \ValidFormBuilder\Fieldset::addField()} @param Element $objField
entailment
public function toJS($intDynamicPosition = 0) { $strReturn = "objForm.addPage('" . $this->getId() . "');\n"; foreach ($this->__elements as $field) { $strReturn .= $field->toJS($intDynamicPosition); } return $strReturn; }
Generate javascript See {@link \ValidFormBuilder\Base::toJS()} @see \ValidFormBuilder\Base::toJS()
entailment
public function getShortHeader() { $strReturn = $this->getHeader(); $strShortLabel = $this->getMeta("summaryLabel", null); if (strlen($strShortLabel) > 0) { $strReturn = $strShortLabel; } return $strReturn; }
Get the short header if available. If no short header is set (meta 'summaryLabel' on the Page object), the full-length regular header is returned. @return string Page (short)header as a string
entailment
public function toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true) { $blnError = ($submitted && ! $this->__validator->validate() && $blnDisplayErrors) ? true : false; if (! $blnSimpleLayout) { // *** We asume that all dynamic fields greater than 0 are never required. if ($this->__validator->getRequired()) { $this->setMeta("class", "vf__required"); } else { $this->setMeta("class", "vf__optional"); } if ($blnError) { $this->setMeta("class", "vf__error"); } if (! $blnLabel) { $this->setMeta("class", "vf__nolabel"); } // Call this right before __getMetaString(); $this->setConditionalMeta(); $strOutput = "<div{$this->__getMetaString()}>\n"; if ($blnError) { $strOutput .= "<p class=\"vf__error\">{$this->__validator->getError()}</p>"; } if ($this->__getValue($submitted)) { // *** Add the "checked" attribute to the input field. $this->setFieldMeta("checked", "checked"); } else { // *** Remove the "checked" attribute from the input field. Just to be sure it wasn't set before. $this->setFieldMeta("checked", null, true); } if ($blnLabel) { $strLabel = (! empty($this->__requiredstyle) && $this->__validator->getRequired()) ? sprintf($this->__requiredstyle, $this->__label) : $this->__label; if (! empty($this->__label)) { $strOutput .= "<label for=\"{$this->__id}\"{$this->__getLabelMetaString()}>{$strLabel}</label>\n"; } } } else { if ($blnError) { $this->setMeta("class", "vf__error"); } $this->setMeta("class", "vf__multifielditem"); // Call this right before __getMetaString(); $this->setConditionalMeta(); $strOutput = "<div{$this->__getMetaString()}>\n"; if ($this->__getValue($submitted)) { // *** Add the "checked" attribute to the input field. $this->setFieldMeta("checked", "checked"); } else { // *** Remove the "checked" attribute from the input field. Just to be sure it wasn't set before. $this->setFieldMeta("checked", null, true); } } $strOutput .= "<input type=\"checkbox\" name=\"{$this->__name}\" id=\"{$this->__id}\"{$this->__getFieldMetaString()}/>\n"; if (! empty($this->__tip)) { $strOutput .= "<small class=\"vf__tip\"{$this->__getTipMetaString()}>{$this->__tip}</small>\n"; } $strOutput .= "</div>\n"; return $strOutput; }
Generate HTML output @see \ValidFormBuilder\Element::toHtml() Element::toHtml() for a full description of this method
entailment
public function toJS($intDynamicPosition = 0) { $strOutput = ""; $strCheck = $this->__sanitizeCheckForJs($this->__validator->getCheck()); $strRequired = ($this->__validator->getRequired()) ? "true" : "false"; ; $intMaxLength = ($this->__validator->getMaxLength() > 0) ? $this->__validator->getMaxLength() : "null"; $intMinLength = ($this->__validator->getMinLength() > 0) ? $this->__validator->getMinLength() : "null"; $strOutput .= "objForm.addElement('{$this->__id}', '{$this->__name}', {$strCheck}, {$strRequired}, {$intMaxLength}, {$intMinLength}, '" . addslashes($this->__validator->getFieldHint()) . "', '" . addslashes($this->__validator->getTypeError()) . "', '" . addslashes($this->__validator->getRequiredError()) . "', '" . addslashes($this->__validator->getHintError()) . "', '" . addslashes($this->__validator->getMinLengthError()) . "', '" . addslashes($this->__validator->getMaxLengthError()) . "');\n"; // *** Condition logic. $strOutput .= $this->conditionsToJs($intDynamicPosition); return $strOutput; }
Generate Javascript @see \ValidFormBuilder\Element::toJS() Element::toJS() for a full description of this method
entailment
public function getValue($intDynamicPosition = 0) { $varValue = parent::getValue($intDynamicPosition); return (strlen($varValue) > 0 && $varValue !== 0) ? true : false; }
Get checkbox value See {@link \ValidFormBuilder\Element::getValue()} @see \ValidFormBuilder\Element::getValue()
entailment
public static function checkRestrictedAccess($route) { Logger::log('Checking admin zone'); //Chequeamos si entramos en el admin if (!Config::getInstance()->checkTryToSaveConfig() && (preg_match('/^\/(admin|setup\-admin)/i', $route) || Config::getParam('restricted', false)) ) { if (!self::isTest() && null === Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true)) { throw new AdminCredentialsException(); } if (!Security::getInstance()->checkAdmin()) { throw new AccessDeniedException(); } Logger::log('Admin access granted'); } }
Method that checks the access to the restricted zone @param string $route @throws AccessDeniedException @throws AdminCredentialsException
entailment
public static function generateToken($secret, $module = 'PSFS', $isOdd = null) { $ts = self::getTs($isOdd); $module = strtolower($module); $hash = hash_hmac('sha256', $module, $secret); $token = self::mixSecret($ts, $hash); $finalToken = self::mixToken($ts, $hash, $token); return $finalToken; }
Generate a authorized token @param string $secret @param string $module @param boolean $isOdd @return string
entailment
private static function decodeToken($token, $force = false) { $decoded = NULL; $parts = self::extractTokenParts($token); list($token, $ts) = self::parseTokenParts($parts); if ($force || time() - (integer)$ts < 300) { $decoded = $token; } return $decoded; }
Decode token to check authorized request @param string $token @param boolean $force @return null|string
entailment
public static function checkToken($token, $secret, $module = 'PSFS') { if (0 === strlen($token) || 0 === strlen($secret)) { return false; } $module = strtolower($module); $decodedToken = self::decodeToken($token); $expectedToken = self::decodeToken(self::generateToken($secret, $module), true); return $decodedToken === $expectedToken; }
Checks if auth token is correct @param string $token @param string $secret @param string $module @return bool
entailment
public function setFirstExecution(\DateTime $firstExecution) { $this->firstExecution = $firstExecution; $this->lastExecution = null; return $this; }
{@inheritdoc}
entailment
public function setInterval( CronExpression $interval, \DateTime $firstExecution = null, \DateTime $lastExecution = null ) { $this->interval = $interval; $this->firstExecution = $firstExecution ?: new \DateTime(); $this->lastExecution = $lastExecution; return $this; }
{@inheritdoc}
entailment
public static function calculateNetworkAddress(Address $address, SubnetMask $subnetMask) { return new Address($address->get() & $subnetMask->get()); }
Calculate the network address of a Block given an IPV4 network address and SubnetMask. @param \JAAulde\IP\V4\Address $address The IP address from which a network address will be derived @param \JAAulde\IP\V4\SubnetMask $subnetMask The subnet mask (in address form) used in the derivation @return \JAAulde\IP\V4\Address
entailment
public static function calculateBroadcastAddress(Address $address, SubnetMask $subnetMask) { return new Address($address->get() | ~$subnetMask->get()); }
Calculate the broadcast address of a Block given an IPV4 network address and SubnetMask. @param \JAAulde\IP\V4\Address $address The IP address from which a broadcast address will be derived @param \JAAulde\IP\V4\SubnetMask $subnetMask The subnet mask (in address form) used in the derivation @return \JAAulde\IP\V4\Address
entailment
public function addField($field) { if (!$field instanceof Base) { throw new \InvalidArgumentException( "No valid object passed to Fieldset::addField(). " . "Object should be an instance of \\ValidFormBuilder\\Base.", E_ERROR ); } $this->__fields->addObject($field); // Set parent element hard, overwrite if previously set. $field->setMeta("parent", $this, true); if ($field->isDynamic() && get_class($field) !== "ValidFormBuilder\\MultiField" && get_class($field) !== "ValidFormBuilder\\Area" ) { $objHidden = new Hidden($field->getId() . "_dynamic", ValidForm::VFORM_INTEGER, array( "default" => 0, "dynamicCounter" => true )); $this->__fields->addObject($objHidden); $field->setDynamicCounter($objHidden); } }
Add an object to the fiedset's elements collection @param \ValidFormBuilder\Base $field The object to add @throws \InvalidArgumentException if property passed to `addField()` is not an instance of Base
entailment
public function toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true) { // Call this right before __getMetaString(); $this->setConditionalMeta(); //*** Set the "id" if not yet set. $this->__setMeta("id", $this->getName(), false); $strOutput = "<fieldset{$this->__getMetaString()}>\n"; if (! empty($this->__header)) { $strOutput .= "<legend><span>{$this->__header}</span></legend>\n"; } if (is_object($this->__note)) { $strOutput .= $this->__note->toHtml(); } foreach ($this->__fields as $field) { $strOutput .= $field->toHtml($submitted, $blnSimpleLayout, $blnLabel, $blnDisplayErrors); } $strOutput .= "</fieldset>\n"; return $strOutput; }
Generate HTML output for this fieldset and all it's children @param boolean $submitted Define if the area has been submitted and propagate that flag to the child fields @param boolean $blnSimpleLayout Only render in simple layout mode @param boolean $blnLabel @param boolean $blnDisplayErrors Display generated errors @return string Rendered Fiedlset and child elements
entailment
public function setAdminHeaders() { $platform = trim(Config::getInstance()->get('platform.name')); header('HTTP/1.1 401 Unauthorized'); header('WWW-Authenticate: Basic Realm="' . $platform . '"'); echo t('Zona restringida'); exit(); }
Servicio que devuelve las cabeceras de autenticación @return string HTML
entailment
public function getAdmins() { $admins = $this->security->getAdmins(); if (!empty($admins)) { if (!$this->security->checkAdmin()) { $this->setAdminHeaders(); } } $this->parseAdmins($admins); return $admins; }
Servicio que devuelve los administradores de la plataforma @return array|mixed
entailment
private function parseAdmins(&$admins) { if (!empty($admins)) { foreach ($admins as &$admin) { if (isset($admin['profile'])) { switch ($admin['profile']) { case Security::MANAGER_ID_TOKEN: $admin['class'] = 'warning'; break; case Security::ADMIN_ID_TOKEN: $admin['class'] = 'info'; break; default: case Security::USER_ID_TOKEN: $admin['class'] = 'primary'; break; } } else { $admin['class'] = 'primary'; } } } }
Servicio que parsea los administradores para mostrarlos en la gestión de usuarios @param array $admins
entailment
public function getLogFiles() { $files = new Finder(); $files->files()->in(LOG_DIR)->name('*.log')->sortByModifiedTime(); $logs = array(); /** @var \SplFileInfo $file */ foreach ($files as $file) { $size = $file->getSize() / 8 / 1024; $time = date('c', $file->getMTime()); $dateTime = new \DateTime($time); if (!isset($logs[$dateTime->format('Y')])) { $logs[$dateTime->format('Y')] = []; } $logs[$dateTime->format('Y')][$dateTime->format('m')][$time] = [ 'filename' => $file->getFilename(), 'size' => round($size, 3), ]; krsort($logs[$dateTime->format('Y')][$dateTime->format('m')]); krsort($logs[$dateTime->format('Y')]); } return $logs; }
Servicio que lee los logs y los formatea para listarlos @return array
entailment
public function formatLogFile($selectedLog) { $monthOpen = null; $files = new Finder(); $files->files()->in(LOG_DIR)->name($selectedLog); $file = $match = null; $log = array(); foreach($files as $item) { $file = $item; $match = $item; break; } /** @var \SplFileInfo $file */ if (null !== $file) { $time = date('c', $file->getMTime()); $dateTime = new \DateTime($time); $monthOpen = $dateTime->format('m'); $content = file($file->getPath() . DIRECTORY_SEPARATOR . $file->getFilename()); krsort($content); $detailLog = array(); foreach ($content as &$line) { list($line, $detail) = $this->parseLogLine($line, $match); $detailLog[] = array_merge([ 'log' => $line, ], $detail); if (count($detailLog) >= 1000) { break; } } unset($line); $log = $detailLog; } return [$log, $monthOpen]; }
Servicio que parsea el fichero de log seleccionado @param string|null $selectedLog @return array
entailment
private function parseLogLine($line, $match) { $line = preg_replace(array('/^\[(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})\]/'), '<span class="label label-success">$4:$5:$6 $3-$2-$1</span>', $line); preg_match_all('/\{(.*)\}/', $line, $match); try { if (!empty($match[0])) { $line = str_replace('[]', '', str_replace($match[0][0], '', $line)); $detail = json_decode($match[0][0], TRUE); } if (empty($detail)) { $detail = array(); } preg_match_all('/\>\ (.*):/', $line, $match); $type = isset($match[1][0]) ? $match[1][0] : ''; $type = explode('.', $type); $type = count($type) > 1 ? $type[1] : $type[0]; switch ($type) { case 'INFO': $detail['type'] = 'success'; break; case 'DEBUG': $detail['type'] = 'info'; break; case 'ERROR': $detail['type'] = 'danger'; break; case 'WARN': $detail['type'] = 'warning'; break; } } catch (\Exception $e) { $detail = [ 'type' => 'danger', ]; } return [$line, $detail]; }
Servicio que trata la línea del log para procesarle en el front end @param $line @param $match @return array
entailment
public function getCharactersCharacterIdCalendar($characterId, $datasource = 'tranquility', $fromEvent = null, $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getCharactersCharacterIdCalendarWithHttpInfo($characterId, $datasource, $fromEvent, $token, $userAgent, $xUserAgent); return $response; }
Operation getCharactersCharacterIdCalendar List calendar event summaries @param int $characterId An EVE character ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $fromEvent The event ID to retrieve events from (optional) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return \nullx27\ESI\nullx27\ESI\Models\GetCharactersCharacterIdCalendar200Ok[]
entailment
public function getCharactersCharacterIdCalendarAsync($characterId, $datasource = 'tranquility', $fromEvent = null, $token = null, $userAgent = null, $xUserAgent = null) { return $this->getCharactersCharacterIdCalendarAsyncWithHttpInfo($characterId, $datasource, $fromEvent, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getCharactersCharacterIdCalendarAsync List calendar event summaries @param int $characterId An EVE character ID (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param int $fromEvent The event ID to retrieve events from (optional) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function getCharactersCharacterIdCalendarEventIdAsync($characterId, $eventId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getCharactersCharacterIdCalendarEventIdAsyncWithHttpInfo($characterId, $eventId, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getCharactersCharacterIdCalendarEventIdAsync Get an event @param int $characterId An EVE character ID (required) @param int $eventId The id of the event requested (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function getCharactersCharacterIdCalendarEventIdAttendees($characterId, $eventId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getCharactersCharacterIdCalendarEventIdAttendeesWithHttpInfo($characterId, $eventId, $datasource, $token, $userAgent, $xUserAgent); return $response; }
Operation getCharactersCharacterIdCalendarEventIdAttendees Get attendees @param int $characterId An EVE character ID (required) @param int $eventId The id of the event requested (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return \nullx27\ESI\nullx27\ESI\Models\GetCharactersCharacterIdCalendarEventIdAttendees200Ok[]
entailment
public function getCharactersCharacterIdCalendarEventIdAttendeesAsync($characterId, $eventId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getCharactersCharacterIdCalendarEventIdAttendeesAsyncWithHttpInfo($characterId, $eventId, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getCharactersCharacterIdCalendarEventIdAttendeesAsync Get attendees @param int $characterId An EVE character ID (required) @param int $eventId The id of the event requested (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function putCharactersCharacterIdCalendarEventIdAsync($characterId, $eventId, $response, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->putCharactersCharacterIdCalendarEventIdAsyncWithHttpInfo($characterId, $eventId, $response, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation putCharactersCharacterIdCalendarEventIdAsync Respond to an event @param int $characterId An EVE character ID (required) @param int $eventId The ID of the event requested (required) @param \nullx27\ESI\nullx27\ESI\Models\PutCharactersCharacterIdCalendarEventIdResponse $response The response value to set, overriding current value. (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $token Access token to use if unable to set a header (optional) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \InvalidArgumentException @return \GuzzleHttp\Promise\PromiseInterface
entailment
public function getSovereigntyStructures($datasource = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getSovereigntyStructuresWithHttpInfo($datasource, $userAgent, $xUserAgent); return $response; }
Operation getSovereigntyStructures List sovereignty structures @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $userAgent Client identifier, takes precedence over headers (optional) @param string $xUserAgent Client identifier, takes precedence over User-Agent (optional) @throws \nullx27\ESI\ApiException on non-2xx response @return \nullx27\ESI\Models\GetSovereigntyStructures200Ok[]
entailment
public function setRecipientType($recipientType) { $allowedValues = $this->getRecipientTypeAllowableValues(); if (!in_array($recipientType, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'recipientType', must be one of '%s'", implode("', '", $allowedValues) ) ); } $this->container['recipientType'] = $recipientType; return $this; }
Sets recipientType @param string $recipientType recipient_type string @return $this
entailment
public function render($content = null) { if ($content === null) { if (!isset($this->parts['{input}'])) { $this->textInput(); } if (!isset($this->parts['{error}'])) { $this->error(); } if (!isset($this->parts['{hint}'])) { $this->hint(null); } if (strpos($this->template,'{label}') !== false) { if (strpos($this->template,'{info}') === false) { $this->template = str_replace('{label}','{beginLabel}{labelTitle}{info}{endLabel}', $this->template); } else { $this->template = str_replace('{label}','{beginLabel}{labelTitle}{endLabel}', $this->template); } } if (!isset($this->parts['{beginWrapper}'])) { $options = $this->wrapperOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); $this->parts['{beginWrapper}'] = Html::beginTag($tag, $options); $this->parts['{endWrapper}'] = Html::endTag($tag); } if (!isset($this->parts['{hidden}'])) { $this->parts['{hidden}'] = ''; } if (!empty($this->parts['{icon}'])) { if (strpos($this->template, '{icon}') === false) { Html::addCssClass($this->iconWrapperOption,'uk-position-relative'); $this->template = str_replace("{input}", Html::tag('div', '{icon}{input}', $this->iconWrapperOptions), $this->template); } } if (!isset($this->parts['{info}'])) { $this->parts['{info}'] = ''; } if (!isset($this->parts['{beginLabel}'])) { $this->label(); } $content = strtr($this->template, $this->parts); } elseif (!is_string($content)) { $content = call_user_func($content, $this); } return $this->begin() . "\n" . $content . "\n" . $this->end(); }
{@inheritdoc}
entailment
public function label($label = null, $options = []) { if ($label === false) { $this->parts['{label}'] = ''; $this->parts['{beginLabel}'] = ''; $this->parts['{endLabel}'] = ''; $this->parts['{labelTitle}'] = ''; return $this; } $options = array_merge($this->labelOptions, $options); if ($label === null) { $attribute = Html::getAttributeName($this->attribute); $label = Html::encode($this->model->getAttributeLabel($attribute)); } if ($this->_skipLabelFor) { $options['for'] = null; } $this->parts['{beginLabel}'] = Html::beginTag('label', $options); $this->parts['{endLabel}'] = Html::endTag('label'); $this->parts['{labelTitle}'] = $label; return $this; }
{@inheritdoc}
entailment
public function icon($icon, $options = []) { if ($icon === false) { $this->parts['{icon}'] = ''; return $this; } $options = array_merge($this->iconOptions, $options); if ($icon !== null) { $uikit = ArrayHelper::remove($options, 'uikit', true); $tag = ArrayHelper::remove($options, 'tag', 'span'); Html::addCssClass($options, 'uk-form-icon'); if (ArrayHelper::remove($options, 'flip', false)) { Html::addCssClass($options, 'uk-form-icon-flip'); } if ($uikit) { IconAsset::register($this->form->view); $options['uk-icon'] = $icon; $this->parts['{icon}'] = Html::tag($tag, '', $options); } else { $this->parts['{icon}'] = Html::tag($tag, $icon, $options); } } return $this; }
Generates an icon tag for [[attribute]]. @param null|string|false $icon the icon to use. If `false`, the generated field will not contain the icon part. Note that this will NOT be [[Html::encode()|encoded]]. @param null|array $options the tag options in terms of name-value pairs. It will be merged with [[iconOptions]]. The options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded @return $this the field object itself.
entailment
public function info($info, $options = []) { $options = array_merge($this->infoOptions, $options); if (isset($options['uk-icon'])) { IconAsset::register($this->form->view); } $tag = ArrayHelper::remove($options, 'tag', 'span'); $options['uk-tooltip'] = 'title: ' . Html::encode($info); $this->parts['{info}'] = Html::tag($tag, '', $options); return $this; }
Generates an info tag in the label for [[attribute]]. @param string $info the info to use. @param null|array $options the tag options in terms of name-value pairs. It will be merged with [[infoOptions]]. The options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded @return $this the field object itself.
entailment
public function checkbox($options = [], $enclosedByLabel = true) { Html::addCssClass($options,'uk-checkbox'); return parent::checkbox($options, $enclosedByLabel); }
{@inheritdoc}
entailment