sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function old($name) { if (isset($this->session)) { return $this->session->getOldInput($this->transformKey($name)); } }
Get a value from the session's old input. @param string $name @return string
entailment
public function getCharactersCharacterIdBookmarks($characterId, $datasource = null, $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getCharactersCharacterIdBookmarksWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent); return $response; }
Operation getCharactersCharacterIdBookmarks List bookmarks @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 preferred over 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 @return \nullx27\ESI\Models\GetCharactersCharacterIdBookmarks200Ok[]
entailment
public function getCharactersCharacterIdBookmarksFolders($characterId, $datasource = null, $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getCharactersCharacterIdBookmarksFoldersWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent); return $response; }
Operation getCharactersCharacterIdBookmarksFolders List bookmark folders @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 preferred over 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 @return \nullx27\ESI\Models\GetCharactersCharacterIdBookmarksFolders200Ok[]
entailment
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null) { $headers = []; // construct the http header $headerParams = array_merge( (array)$this->config->getDefaultHeaders(), (array)$headerParams ); foreach ($headerParams as $key => $val) { $headers[] = "$key: $val"; } // form data if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers, true)) { $postData = http_build_query($postData); } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers, true)) { // json model $postData = json_encode(\nullx27\ESI\ObjectSerializer::sanitizeForSerialization($postData)); } $url = $this->config->getHost() . $resourcePath; $curl = curl_init(); // set timeout, if needed if ($this->config->getCurlTimeout() !== 0) { curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); } // return the result on success, rather than just true curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); // disable SSL verification, if needed if ($this->config->getSSLVerification() === false) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); } if (!empty($queryParams)) { $url = ($url . '?' . http_build_query($queryParams)); } if ($method === self::$POST) { curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); } elseif ($method === self::$HEAD) { curl_setopt($curl, CURLOPT_NOBODY, true); } elseif ($method === self::$OPTIONS) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); } elseif ($method === self::$PATCH) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); } elseif ($method === self::$PUT) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); } elseif ($method === self::$DELETE) { curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); } elseif ($method !== self::$GET) { throw new ApiException('Method ' . $method . ' is not recognized.'); } curl_setopt($curl, CURLOPT_URL, $url); // Set user agent curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent()); // debugging for curl if ($this->config->getDebug()) { error_log("[DEBUG] HTTP Request body ~BEGIN~".PHP_EOL.print_r($postData, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile()); curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a')); } else { curl_setopt($curl, CURLOPT_VERBOSE, 0); } // obtain the HTTP response headers curl_setopt($curl, CURLOPT_HEADER, 1); // Make the request $response = curl_exec($curl); $http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE); $http_header = $this->httpParseHeaders(substr($response, 0, $http_header_size)); $http_body = substr($response, $http_header_size); $response_info = curl_getinfo($curl); // debug HTTP response body if ($this->config->getDebug()) { error_log("[DEBUG] HTTP Response body ~BEGIN~".PHP_EOL.print_r($http_body, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile()); } // Handle the response if ($response_info['http_code'] === 0) { $curl_error_message = curl_error($curl); // curl_exec can sometimes fail but still return a blank message from curl_error(). if (!empty($curl_error_message)) { $error_message = "API call to $url failed: $curl_error_message"; } else { $error_message = "API call to $url failed, but for an unknown reason. " . "This could happen if you are disconnected from the network."; } $exception = new ApiException($error_message, 0, null, null); $exception->setResponseObject($response_info); throw $exception; } elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) { // return raw body if response is a file if ($responseType === '\SplFileObject' || $responseType === 'string') { return [$http_body, $response_info['http_code'], $http_header]; } $data = json_decode($http_body); if (json_last_error() > 0) { // if response is a string $data = $http_body; } } else { $data = json_decode($http_body); if (json_last_error() > 0) { // if response is a string $data = $http_body; } throw new ApiException( "[".$response_info['http_code']."] Error connecting to the API ($url)", $response_info['http_code'], $http_header, $data ); } return [$data, $response_info['http_code'], $http_header]; }
Make the HTTP call (Sync) @param string $resourcePath path to method endpoint @param string $method method to call @param array $queryParams parameters to be place in query URL @param array $postData parameters to be placed in POST body @param array $headerParams parameters to be place in request header @param string $responseType expected response type of the endpoint @param string $endpointPath path to method endpoint before expanding parameters @throws \nullx27\ESI\ApiException on a non 2xx response @return mixed
entailment
public function getRouteOriginDestinationWithHttpInfo($destination, $origin, $avoid = null, $connections = null, $datasource = null, $flag = null, $userAgent = null, $xUserAgent = null) { // verify the required parameter 'destination' is set if ($destination === null) { throw new \InvalidArgumentException('Missing the required parameter $destination when calling getRouteOriginDestination'); } // verify the required parameter 'origin' is set if ($origin === null) { throw new \InvalidArgumentException('Missing the required parameter $origin when calling getRouteOriginDestination'); } if (!is_null($avoid) && (count($avoid) > 100)) { throw new \InvalidArgumentException('invalid value for "$avoid" when calling RoutesApi.getRouteOriginDestination, number of items must be less than or equal to 100.'); } if (!is_null($connections) && (count($connections) > 100)) { throw new \InvalidArgumentException('invalid value for "$connections" when calling RoutesApi.getRouteOriginDestination, number of items must be less than or equal to 100.'); } // parse inputs $resourcePath = "/route/{origin}/{destination}/"; $httpBody = ''; $queryParams = []; $headerParams = []; $formParams = []; $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); // query params if (is_array($avoid)) { $avoid = $this->apiClient->getSerializer()->serializeCollection($avoid, 'csv', true); } if ($avoid !== null) { $queryParams['avoid'] = $this->apiClient->getSerializer()->toQueryValue($avoid); } // query params if (is_array($connections)) { $connections = $this->apiClient->getSerializer()->serializeCollection($connections, 'csv', true); } if ($connections !== null) { $queryParams['connections'] = $this->apiClient->getSerializer()->toQueryValue($connections); } // query params if ($datasource !== null) { $queryParams['datasource'] = $this->apiClient->getSerializer()->toQueryValue($datasource); } // query params if ($flag !== null) { $queryParams['flag'] = $this->apiClient->getSerializer()->toQueryValue($flag); } // query params if ($userAgent !== null) { $queryParams['user_agent'] = $this->apiClient->getSerializer()->toQueryValue($userAgent); } // header params if ($xUserAgent !== null) { $headerParams['X-User-Agent'] = $this->apiClient->getSerializer()->toHeaderValue($xUserAgent); } // path params if ($destination !== null) { $resourcePath = str_replace( "{" . "destination" . "}", $this->apiClient->getSerializer()->toPathValue($destination), $resourcePath ); } // path params if ($origin !== null) { $resourcePath = str_replace( "{" . "origin" . "}", $this->apiClient->getSerializer()->toPathValue($origin), $resourcePath ); } // default format to json $resourcePath = str_replace("{format}", "json", $resourcePath); // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'GET', $queryParams, $httpBody, $headerParams, 'int[]', '/route/{origin}/{destination}/' ); return [$this->apiClient->getSerializer()->deserialize($response, 'int[]', $httpHeader), $statusCode, $httpHeader]; } catch (ApiException $e) { switch ($e->getCode()) { case 200: $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'int[]', $e->getResponseHeaders()); $e->setResponseObject($data); break; case 404: $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\nullx27\ESI\Models\GetRouteOriginDestinationNotFound', $e->getResponseHeaders()); $e->setResponseObject($data); break; case 500: $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\nullx27\ESI\Models\GetRouteOriginDestinationInternalServerError', $e->getResponseHeaders()); $e->setResponseObject($data); break; } throw $e; } }
Operation getRouteOriginDestinationWithHttpInfo Get route @param int $destination destination solar system ID (required) @param int $origin origin solar system ID (required) @param int[] $avoid avoid solar system ID(s) (optional) @param int[][] $connections connected solar system pairs (optional) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $flag route security preference (optional, default to shortest) @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 array of int[], HTTP status code, HTTP response headers (array of strings)
entailment
public function setConfiguration(Reader $configuration): void { $this->configuration = $configuration; $this->configEntities = $configuration->getConfigValues()['entities']; $this->initFaker(); }
Set the configuration @param Reader $configuration
entailment
public function setLimit(int $limit) { $this->limit = $limit; if ($this->limit < $this->batchSize) { $this->batchSize = $this->limit; } return $this; }
Limit of fake generated records for updates and creates @param int $limit @return mixed
entailment
protected function whatToDoWithEntity(): int { $this->checkEntityIsInConfig(); $entityConfig = $this->configEntities[$this->entity]; $actions = 0; if (array_key_exists('cols', $entityConfig)) { switch ($entityConfig['action']) { case 'update': $actions |= self::UPDATE_TABLE; break; case 'insert': $actions |= self::INSERT_TABLE; break; } } return $actions; }
Evaluate, from the configuration if I have to update or Truncate the table @return int @throws NeuralyzerConfigurationException
entailment
protected function generateFakeData(): array { $this->checkEntityIsInConfig(); $colsInConfig = $this->configEntities[$this->entity]['cols']; $row = []; foreach ($colsInConfig as $colName => $colProps) { $this->checkColIsInEntity($colName); $data = \call_user_func_array( [$this->getFakerObject($this->entity, $colName, $colProps), $colProps['method']], $colProps['params'] ); if (!is_scalar($data)) { $msg = "You must use faker methods that generate strings: '{$colProps['method']}' forbidden"; throw new NeuralyzerConfigurationException($msg); } $row[$colName] = trim($data); $colLength = $this->entityCols[$colName]['length']; // Cut the value if too long ... if (!empty($colLength) && \strlen($row[$colName]) > $colLength) { $row[$colName] = substr($row[$colName], 0, $colLength - 1); } } return $row; }
Generate fake data for an entity and return it as an Array @return array @throws NeuralyzerConfigurationException
entailment
protected function checkEntityIsInConfig(): void { if (empty($this->configEntities)) { throw new NeuralyzerConfigurationException( 'No entities found. Have you loaded a configuration file ?' ); } if (!array_key_exists($this->entity, $this->configEntities)) { throw new NeuralyzerConfigurationException( "No configuration for that entity ({$this->entity})" ); } }
Make sure that entity is defined in the configuration @throws NeuralyzerConfigurationException
entailment
protected function initFaker(): void { $language = $this->configuration->getConfigValues()['language']; $this->faker = \Faker\Factory::create($language); $this->faker->addProvider(new \Edyan\Neuralyzer\Faker\Provider\Base($this->faker)); $this->faker->addProvider(new \Edyan\Neuralyzer\Faker\Provider\UniqueWord($this->faker, $language)); }
Init Faker and add additional methods
entailment
protected function getFakerObject(string $entityName, string $colName, array $colProps) { if (!isset($this->fakers[$entityName][$colName])) { $fakerClone = clone $this->faker; $this->fakers[$entityName][$colName] = isset($colProps['unique']) && $colProps['unique'] === true ? $fakerClone->unique() : $fakerClone; } return $this->fakers[$entityName][$colName]; }
Get the faker object for a entity column @param string $entityName @param string $colName @param array $colProps @return \Faker\Generator|\Faker\UniqueGenerator
entailment
public function getSearch($categories, $search, $datasource = null, $language = null, $strict = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getSearchWithHttpInfo($categories, $search, $datasource, $language, $strict, $userAgent, $xUserAgent); return $response; }
Operation getSearch Search on a string @param string[] $categories Type of entities to search for (required) @param string $search The string to search on (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $language Search locale (optional, default to en-us) @param bool $strict Whether the search should be a strict match (optional, default to false) @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\GetSearchOk
entailment
public function toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true) { $strOutput = ""; $intDynamicCount = $this->getDynamicCount(); for ($intCount = 0; $intCount <= $intDynamicCount; $intCount ++) { $strOutput .= $this->__toHtml($submitted, $blnSimpleLayout, $blnLabel, $blnDisplayErrors, $intCount); } return $strOutput; }
Generate HTML output See {@link \ValidFormBuilder\Element::toHtml()} @see \ValidFormBuilder\Element::toHtml()
entailment
public function __toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true, $intCount = 0) { $blnError = ($submitted && ! $this->__validator->validate($intCount) && $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"); } // *** Set custom meta. 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($intCount)}</p>"; } if ($blnLabel) { $strLabel = (! empty($this->__requiredstyle) && $this->__validator->getRequired()) ? sprintf($this->__requiredstyle, $this->__label) : $this->__label; if (! empty($this->__label)) { $strOutput .= "<label{$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"; } $strOutput .= "<fieldset{$this->__getFieldMetaString()}>\n"; foreach ($this->__fields as $objField) { switch (get_class($objField)) { case "ValidFormBuilder\\GroupField": $strOutput .= $objField->toHtmlInternal($this->__getValue($submitted, $intCount), $submitted, $intCount); break; } } $strOutput .= "</fieldset>\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 {@link \ValidFormBuilder\Element::__toHtml()} @see \ValidFormBuilder\Element::__toHtml()
entailment
public function getId() { return (strpos($this->__id, "[]") !== false) ? str_replace("[]", "", $this->__id) : $this->__id; }
Get element's ID This automatically strips off the [] from a checkbox ID @return string The element's ID
entailment
public function getName($blnPlain = false) { $strReturn = ""; if ($blnPlain) { $strReturn = $this->__name; } else { switch ($this->__type) { case ValidForm::VFORM_RADIO_LIST: $strReturn = $this->__name; break; case ValidForm::VFORM_CHECK_LIST: $strReturn = (strpos($this->__name, "[]") === false) ? $this->__name . "[]" : $this->__name; break; } } return $strReturn; }
Get the element's name This automatically strips off the [] from a checkbox ID @see \ValidFormBuilder\Base::getName() @param bool $blnPlain If false, [] will be stripped from a checklist group name @return string The element's name
entailment
public function addField($label, $value, $checked = false, $meta = array()) { $name = $this->getName(); $objField = new GroupField($this->getRandomId($name), $name, $this->__type, $label, $value, $checked, $meta); $objField->setMeta("parent", $this, true); $this->__fields->addObject($objField); // *** Set the default value if "checked" is set. if ($checked) { switch ($this->__type) { case ValidForm::VFORM_CHECK_LIST: $arrDefault = (is_array($this->__default)) ? $this->__default : array($this->__default); $arrDefault[] = $value; $this->__default = $arrDefault; break; default: $this->__default = $value; } } return $objField; }
Add either a radio button or checkbox to the group @param string $label The label @param string $value The value @param boolean $checked Set to true if this item should be checked / selected by default @param array $meta The meta array @return \ValidFormBuilder\GroupField
entailment
public function getStatus($datasource = 'tranquility', $userAgent = null, $xUserAgent = null) { list($response) = $this->getStatusWithHttpInfo($datasource, $userAgent, $xUserAgent); return $response; }
Operation getStatus Retrieve the uptime and player counts @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\GetStatusOk
entailment
public function getStatusAsync($datasource = 'tranquility', $userAgent = null, $xUserAgent = null) { return $this->getStatusAsyncWithHttpInfo($datasource, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getStatusAsync Retrieve the uptime and player counts @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 init() { $this->initSession(); $this->session = null === $_SESSION ? array() : $_SESSION; if (NULL === $this->getSessionKey('__FLASH_CLEAR__')) { $this->clearFlashes(); $this->setSessionKey('__FLASH_CLEAR__', microtime(TRUE)); } $this->user = array_key_exists(self::USER_ID_TOKEN, $this->session) ? unserialize($this->session[self::USER_ID_TOKEN]) : NULL; $this->admin = array_key_exists(self::ADMIN_ID_TOKEN, $this->session) ? unserialize($this->session[self::ADMIN_ID_TOKEN]) : NULL; if (null === $this->admin) { $this->checkAdmin(); } $this->setLoaded(true); }
Constructor por defecto
entailment
public function checkAdmin($user = NULL, $pass = NULL, $force = false) { Logger::log('Checking admin session'); if ((!$this->authorized && !$this->checked) || $force) { $admins = $this->getAdmins(); if (null !== $admins) { $request = Request::getInstance(); //Sacamos las credenciales de la petición $user = $user ?: $request->getServer('PHP_AUTH_USER'); $pass = $pass ?: $request->getServer('PHP_AUTH_PW'); if (NULL === $user || (array_key_exists($user, $admins) && empty($admins[$user]))) { list($user, $pass) = $this->getAdminFromCookie(); } if (!empty($user) && !empty($admins[$user])) { $auth = $admins[$user]['hash']; $this->authorized = ($auth === sha1($user . $pass)); if ($this->authorized) { $this->updateAdmin($user , $admins[$user]['profile']); ResponseHelper::setCookieHeaders([ [ 'name' => $this->getHash(), 'value' => base64_encode("$user:$pass"), 'http' => true, 'domain' => '', ] ]); $this->setSessionKey(self::LOGGED_USER_TOKEN, base64_encode("{$user}:{$pass}")); } } else { $this->admin = null; $this->setSessionKey(self::ADMIN_ID_TOKEN, null); } $this->checked = true; } } return $this->authorized || self::isTest(); }
@param string $user @param string $pass @param boolean $force @return bool
entailment
protected function getAdminFromCookie() { $auth_cookie = Request::getInstance()->getCookie($this->getHash()); $user = $pass = array(); if (!empty($auth_cookie)) { list($user, $pass) = explode(':', base64_decode($auth_cookie)); } return array($user, $pass); }
Método que obtiene el usuario y contraseña de la cookie de sesión de administración @return array
entailment
public function addButton($label, $meta = array()) { $objButton = new Button($label, $meta); // *** Set the parent for the new field. $objButton->setMeta("parent", $this, true); $this->__fields->addObject($objButton); return $objButton; }
Add a button to the navigation object @param string $label Button label @param array $meta The meta array @return \ValidFormBuilder\Button
entailment
public function addHtml($html, $meta = array()) { $objString = new StaticText($html, $meta); $objString->setMeta("parent", $this, true); $this->__fields->addObject($objString); return $objString; }
Inject HTML in the navigation element @param string $html The HTML string @param array $meta Optional meta array @return \ValidFormBuilder\StaticText
entailment
public function toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayError = true) { $this->setConditionalMeta(); $this->setMeta("class", "vf__navigation"); $strReturn = "<div{$this->__getMetaString()}>\n"; foreach ($this->__fields as $field) { $strReturn .= $field->toHtml($submitted, $blnSimpleLayout, $blnLabel, $blnDisplayError); } $strReturn .= "</div>\n"; return $strReturn; }
Render the Navigation and it's children @param boolean $submitted Define if the element 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 $blnDisplayError Display generated errors @return string Rendered Navigation
entailment
public function getActivityAllowableValues() { return [ self::ACTIVITY_NONE, self::ACTIVITY_MANUFACTURING, self::ACTIVITY_RESEARCHING_TECHNOLOGY, self::ACTIVITY_RESEARCHING_TIME_EFFICIENCY, self::ACTIVITY_RESEARCHING_MATERIAL_EFFICIENCY, self::ACTIVITY_COPYING, self::ACTIVITY_DUPLICATING, self::ACTIVITY_INVENTION, self::ACTIVITY_REVERSE_ENGINEERING, ]; }
Gets allowable values of the enum @return string[]
entailment
public function setActivity($activity) { $allowed_values = array('none', 'manufacturing', 'researching_technology', 'researching_time_efficiency', 'researching_material_efficiency', 'copying', 'duplicating', 'invention', 'reverse_engineering'); if (!in_array($activity, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for 'activity', must be one of 'none', 'manufacturing', 'researching_technology', 'researching_time_efficiency', 'researching_material_efficiency', 'copying', 'duplicating', 'invention', 'reverse_engineering'"); } $this->container['activity'] = $activity; return $this; }
Sets activity @param string $activity activity string @return $this
entailment
public function getCharactersCharacterIdOpportunities($characterId, $datasource = null, $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getCharactersCharacterIdOpportunitiesWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent); return $response; }
Operation getCharactersCharacterIdOpportunities Get a character's completed tasks @param int $characterId ID for a character (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $token Access token to use, if preferred over 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 @return \nullx27\ESI\Models\GetCharactersCharacterIdOpportunities200Ok[]
entailment
public function getOpportunitiesGroups($datasource = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getOpportunitiesGroupsWithHttpInfo($datasource, $userAgent, $xUserAgent); return $response; }
Operation getOpportunitiesGroups Get opportunities groups @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 getOpportunitiesTasksTaskId($taskId, $datasource = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getOpportunitiesTasksTaskIdWithHttpInfo($taskId, $datasource, $userAgent, $xUserAgent); return $response; }
Operation getOpportunitiesTasksTaskId Get opportunities task @param int $taskId ID of an opportunities task (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\GetOpportunitiesTasksTaskIdOk
entailment
public function getIncursions($datasource = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getIncursionsWithHttpInfo($datasource, $userAgent, $xUserAgent); return $response; }
Operation getIncursions List incursions @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\GetIncursions200Ok[]
entailment
public static function asset($string, $name = null, $return = true) { $filePath = ''; if (!file_exists($filePath)) { $filePath = BASE_DIR . $string; } $filenamePath = AssetsParser::findDomainPath($string, $filePath); $filePath = self::processAsset($string, $name, $return, $filenamePath); $basePath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl()); $returnPath = empty($name) ? $basePath . '/' . $filePath : $name; return $return ? $returnPath : ''; }
Función que copia los recursos de las carpetas Public al DocumentRoot @param $string @param null $name @param bool|TRUE $return @return string
entailment
public static function route($path = '', $absolute = false, array $params = []) { $router = Router::getInstance(); try { return $router->getRoute($path, $absolute, $params); } catch (\Exception $e) { return $router->getRoute('', $absolute, $params); } }
Función que devuelve una url correspondiente a una ruta @param string $path @param bool|FALSE $absolute @param array $params @return string|null
entailment
public static function resource($path, $dest, $force = false) { $debug = Config::getParam('debug'); $domains = Template::getDomains(true); $filenamePath = self::extractPathname($path, $domains); \PSFS\Services\GeneratorService::copyResources($dest, $force, $filenamePath, $debug); return ''; }
Función que copia un recurso directamente en el DocumentRoot @param string $path @param string $dest @param bool|FALSE $force @return string @throws ConfigException
entailment
private static function extractPathname($path, $domains) { $filenamePath = $path; if (!empty($domains) && !file_exists($path)) { foreach ($domains as $domain => $paths) { $domainFilename = str_replace($domain, $paths['public'], $path); if (file_exists($domainFilename)) { $filenamePath = $domainFilename; continue; } } } return $filenamePath; }
Método que extrae el pathname para un dominio @param string $path @param $domains @return mixed
entailment
private static function putResourceContent($name, $filenamePath, $base, $filePath) { $data = file_get_contents($filenamePath); if (!empty($name)) { file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data); }else { file_put_contents($base . $filePath, $data); } }
Método que copia el contenido de un recurso en su destino correspondiente @param string $name @param string $filenamePath @param string $base @param string $filePath
entailment
private static function processAsset($string, $name, $return, $filenamePath) { $filePath = $filenamePath; if (file_exists($filenamePath)) { list($base, $htmlBase, $filePath) = AssetsParser::calculateAssetPath($string, $name, $return, $filenamePath); //Creamos el directorio si no existe GeneratorHelper::createDir($base . $htmlBase); //Si se ha modificado if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($filenamePath)) { if ($htmlBase === 'css') { self::processCssLines($filenamePath); } self::putResourceContent($name, $filenamePath, $base, $filePath); } } return $filePath; }
Método que procesa un recurso para su copia en el DocumentRoot @param string $string @param string $name @param boolean $return @param string $filenamePath @return mixed @throws \PSFS\base\exception\GeneratorException
entailment
public static function getFlash($key) { $var = Security::getInstance()->getFlash($key); Security::getInstance()->setFlash($key, null); return $var; }
Template function that get a flash session var @param string $key @return mixed
entailment
protected function extractTmpAttribute($node = null, $value = null) { $tmp = []; if (null === $node) { $node = $value; } else { $tmp = $this->getTmpAttribute($node); } if(null !== $node) { $tmp[] = $value->getAttribute('value'); } return [$tmp, $node]; }
Método @param \Twig_Node_Expression|\Twig_Node_Expression_Conditional|null $node @param \Twig_Node_Expression|\Twig_Node_Expression_Conditional|null $value @return array
entailment
public function handle(GetResponseEvent $event) { $request = $event->getRequest(); $requestToken = $this->getToken( $request->headers->get($this->options['header_name'], null) ); if (!empty($requestToken)) { try { $decoded = $this->encode->decode($requestToken); $user = null; if (isset($decoded->{$this->options['username_claim']})) { $user = $decoded->{$this->options['username_claim']}; } $token = new JWTToken( $user, $requestToken, $this->providerKey ); $authToken = $this->authenticationManager->authenticate($token); $this->securityContext->setToken($authToken); } catch (HttpEncodingException $e) { } catch (\UnexpectedValueException $e) { } } }
This interface must be implemented by firewall listeners. @param GetResponseEvent $event
entailment
protected function getToken($requestToken) { $prefix = $this->options['token_prefix']; if (null === $prefix) { return $requestToken; } if (null === $requestToken) { return $requestToken; } $requestToken = trim(str_replace($prefix, "", $requestToken)); return $requestToken; }
Convert token with prefix to normal token @param $requestToken @return string
entailment
public function listInvalidProperties() { $invalidProperties = []; if (!is_null($this->container['unreadCount']) && ($this->container['unreadCount'] < 0)) { $invalidProperties[] = "invalid value for 'unreadCount', must be bigger than or equal to 0."; } if (!is_null($this->container['labelId']) && ($this->container['labelId'] < 0)) { $invalidProperties[] = "invalid value for 'labelId', must be bigger than or equal to 0."; } if (!is_null($this->container['name']) && (strlen($this->container['name']) > 40)) { $invalidProperties[] = "invalid value for 'name', the character length must be smaller than or equal to 40."; } $allowedValues = $this->getColorAllowableValues(); if (!in_array($this->container['color'], $allowedValues)) { $invalidProperties[] = sprintf( "invalid value for 'color', must be one of '%s'", implode("', '", $allowedValues) ); } return $invalidProperties; }
Show all the invalid properties with reasons. @return array invalid properties with reasons
entailment
public function setUnreadCount($unreadCount) { if (!is_null($unreadCount) && ($unreadCount < 0)) { throw new \InvalidArgumentException('invalid value for $unreadCount when calling GetCharactersCharacterIdMailLabelsLabel., must be bigger than or equal to 0.'); } $this->container['unreadCount'] = $unreadCount; return $this; }
Sets unreadCount @param int $unreadCount unread_count integer @return $this
entailment
public function setLabelId($labelId) { if (!is_null($labelId) && ($labelId < 0)) { throw new \InvalidArgumentException('invalid value for $labelId when calling GetCharactersCharacterIdMailLabelsLabel., must be bigger than or equal to 0.'); } $this->container['labelId'] = $labelId; return $this; }
Sets labelId @param int $labelId label_id integer @return $this
entailment
public function setColor($color) { $allowedValues = $this->getColorAllowableValues(); if (!is_null($color) && !in_array($color, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'color', must be one of '%s'", implode("', '", $allowedValues) ) ); } $this->container['color'] = $color; return $this; }
Sets color @param string $color color string @return $this
entailment
public function cacheSubscribers($num = 1000, $page = 1) { if ($this->cached != null) { return $this->cached; } $this->cached = $this->client->call( 'GET', 'subscribers', [ 'query' => [ 'per_page' => $num, 'current_page' => $page, ], ] ); return $this->cached; }
Cache Subscribers for performance improvement. @param int $num @param int $page @return array|bool
entailment
public function indexSubscribers($num = 1000, $page = 1) { if ($this->cache != false) { return $this->cacheSubscribers($num, $page); } return $this->client->call( 'GET', 'subscribers', [ 'query' => [ 'per_page' => $num, 'current_page' => $page, ], ] ); }
Get a defined number of Subscribers. @param int $num @param int $page @return array|bool
entailment
public function searchSubscribers($search, $by, $limit = 1, $num = 1000, $page = 1) { $subscribers = $this->indexSubscribers($num, $page)['data']; $filtered = array_filter( $subscribers, function ($subscriber) use ($search, $by) { if (array_key_exists($by, $subscriber)) { if (strpos($subscriber[$by], $search) !== false) { return $subscriber; } if ($subscriber[$by] === $search) { return $subscriber; } } return false; } ); if ($limit == 1) { return array_shift($filtered); } return array_slice($filtered, 0, $limit); }
Search if a defined number of Subscribers exists. @param string $search @param string $by @param int $num @param int $page @param int $limit @return mixed
entailment
public function getDomain() { $model = explode("\\", $this->getModelNamespace()); return strlen($model[0]) || 1 === count($model) ? $model[0] : $model[1]; }
Method that extract the Domain name @return mixed
entailment
protected function hydrateFromRequest() { $class = new \ReflectionClass($this->getModelNamespace()); $this->model = $class->newInstance(); $this->hydrateModelFromRequest($this->model, $this->data); }
Hydrate fields from request
entailment
protected function hydrateBulkRequest() { $class = new \ReflectionClass($this->getModelNamespace()); $this->list = []; foreach($this->data as $item) { if(is_array($item)) { if(count($this->list) < Config::getParam('api.block.limit', 1000)) { /** @var ActiveRecordInterface $model */ $model = $class->newInstance(); $this->hydrateModelFromRequest($model, $item); $this->list[] = $model; } else { Logger::log(t('Max items per bulk insert raised'), LOG_WARNING, count($this->data) . t('items')); } } } }
Hydrate list elements for bulk insert
entailment
protected function saveBulk() { $tablemap = $this->getTableMap(); foreach($this->list as &$model) { $con = Propel::getWriteConnection($tablemap::DATABASE_NAME); try { $model->save($con); $con->commit(); } catch(\Exception $e) { Logger::log($e->getMessage(), LOG_ERR, $model->toArray()); $con->rollBack(); } } }
Save the list of items
entailment
protected function hydrateModel($primaryKey) { try { $query = $this->prepareQuery(); $this->model = $this->findPk($query, $primaryKey); } catch (\Exception $e) { Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR); } }
Hydrate model from pk @param string $primaryKey
entailment
protected function _get($primaryKey) { $this->hydrateModel($primaryKey); return ($this->getModel() instanceof ActiveRecordInterface) ? $this->getModel() : NULL; }
Extract specific entity @param integer $primaryKey @return null|ActiveRecordInterface
entailment
public function json($response, $status = 200) { $this->closeTransaction($status); return $this->_json($response, $status); }
Wrapper for json parent method with close transactions and close connections tasks @param \PSFS\base\dto\JsonResponse $response @param int $status @return mixed
entailment
public function loadData(string $table, string $fname, array $fields, string $mode): string { if (substr(gethostbyname($this->conn->getHost()), 0, 3) !== '127') { throw new NeuralyzerException('SQL Server must be on the same host than PHP'); } $sql ="BULK INSERT {$table} FROM '{$fname}' WITH ( FIELDTERMINATOR = '|', DATAFILETYPE = 'widechar', ROWTERMINATOR = '" . PHP_EOL . "' )"; if ($this->pretend === false) { if ($mode === 'update') { $this->conn->query("TRUNCATE TABLE {$table}"); } $this->conn->query($sql); } return $sql; }
{@inheritdoc}
entailment
protected function getModelNamespace() { /** @var TableMap $tableMap */ $tableMap = $this->getModelTableMap(); return (null !== $tableMap) ? $tableMap::getOMClass(FALSE) : null; }
Extract model api namespace @return mixed
entailment
protected function addDefaultListField() { if (!in_array(Api::API_LIST_NAME_FIELD, array_values($this->extraColumns))) { /** @var TableMap $tableMap */ $tableMap = $this->getTableMap(); /** @var ColumnMap $column */ $column = null; if ($tableMap->hasColumn('NAME')) { $column = $tableMap->getColumn('NAME'); } elseif ($tableMap->hasColumn('TITLE')) { $column = $tableMap->getColumn('TITLE'); } elseif ($tableMap->hasColumn('LABEL')) { $column = $tableMap->getColumn('LABEL'); } if (null !== $column) { $this->extraColumns[$column->getFullyQualifiedName()] = Api::API_LIST_NAME_FIELD; } else { $this->addClassListName($tableMap); } } }
Method that add a new field with the Label of the row
entailment
public function getOnce($key, $default = null) { $read = $this->get($key, $default); $this->delete($key); return $read; }
Read a value from the session and unset it, this is a form of read once flash memory using the session. @param string $key in session variable. @param mixed $default default value to return when key is not set in the session. @return mixed value from session and null if not set.
entailment
public function setEventType($eventType) { $allowedValues = $this->getEventTypeAllowableValues(); if (!in_array($eventType, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for 'eventType', must be one of '%s'", implode("', '", $allowedValues) ) ); } $this->container['eventType'] = $eventType; return $this; }
Sets eventType @param string $eventType Type of event this campaign is for. tcu_defense, ihub_defense and station_defense are referred to as \"Defense Events\", station_freeport as \"Freeport Events\". @return $this
entailment
public function setDescription($description) { if ((strlen($description) > 500)) { throw new \InvalidArgumentException('invalid length for $description when calling PostCharactersCharacterIdFittingsFitting., must be smaller than or equal to 500.'); } if ((strlen($description) < 0)) { throw new \InvalidArgumentException('invalid length for $description when calling PostCharactersCharacterIdFittingsFitting., must be bigger than or equal to 0.'); } $this->container['description'] = $description; return $this; }
Sets description @param string $description description string @return $this
entailment
public function setName($name) { if ((strlen($name) > 50)) { throw new \InvalidArgumentException('invalid length for $name when calling PostCharactersCharacterIdFittingsFitting., must be smaller than or equal to 50.'); } if ((strlen($name) < 1)) { throw new \InvalidArgumentException('invalid length for $name when calling PostCharactersCharacterIdFittingsFitting., must be bigger than or equal to 1.'); } $this->container['name'] = $name; return $this; }
Sets name @param string $name name string @return $this
entailment
public function addParagraph($strBody, $strHeader = "", $meta = array()) { $objParagraph = new Paragraph($strHeader, $strBody, $meta); $objParagraph->setMeta("parent", $this, true); // *** Add field to the fieldset. $this->__fields->addObject($objParagraph); return $objParagraph; }
Add paragraph to Area #### Example ```php $objArea->addParagraph( "Cool paragraph with lots of text in it. It's an absolute must-read.", "You must read this" ); ``` @param string $strBody The paragraph's body text @param string $strHeader The paragraph's optional header @param array $meta Standard meta array @return \ValidFormBuilder\Paragraph
entailment
public function addMultiField($label = null, $meta = array()) { if (!array_key_exists("dynamic", $meta)) { $meta["dynamic"] = $this->__dynamic; } // *** Overwrite dynamic settings. We cannot have a dynamic multifield inside a dynamic area. if ($this->__dynamic) { $meta["dynamic"] = $this->__dynamic; $meta["dynamicLabel"] = ""; } $objField = new MultiField($label, $meta); $objField->setRequiredStyle($this->__requiredstyle); $objField->setMeta("parent", $this, true); $this->__fields->addObject($objField); return $objField; }
Add a multifield to the Area @param string $label The multifield's label @param array $meta The standard meta array @return \ValidFormBuilder\MultiField
entailment
public function hasContent($intCount = 0) { $blnReturn = false; foreach ($this->__fields as $objField) { if (get_class($objField) !== "ValidFormBuilder\\Hidden" || get_class($objField) !== "ValidFormBuilder\\Paragraph") { if (get_class($objField) == "ValidFormBuilder\\MultiField") { $blnReturn = $objField->hasContent($intCount); if ($blnReturn) { break; } } else { if ($objField instanceof Element) { $varValue = $objField->getValidator()->getValue($intCount); if (! empty($varValue)) { $blnReturn = true; break; } } } } } return $blnReturn; }
Verify if any of the child fields in this area has submitted data @param integer $intCount Optional counter to do the same for dynamic multifields. @return boolean True if area childs contain submitted data, false if not.
entailment
protected function __toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true, $intCount = 0) { // *** Conditional meta should be set before all other meta. Otherwise the set meta is being reset. $this->setConditionalMeta(); $strName = ($intCount == 0) ? $this->getName() : $this->getName() . "_" . $intCount; if ($this->__active && $this->__checked && ! $submitted) { $this->setFieldMeta("checked", "checked", true); } if ($this->__active && $submitted && $this->hasContent($intCount)) { $this->setFieldMeta("checked", "checked", true); } $this->setMeta("class", "vf__area"); if ($this->__active && is_null($this->getFieldMeta("checked", null))) { $this->setMeta("class", "vf__disabled"); } if ($intCount > 0) { $this->setMeta("class", "vf__clone"); } //*** If this is a removable field, add corresponding class if ($this->isRemovable()) { $this->setMeta("class", "vf__removable"); } //*** Add data-dynamic="original" or data-dynamic="clone" attributes to dynamic fields if ($this->isDynamic()) { if ($intCount === 0) { // This is the first, original element. Make sure to define that. $this->setMeta('data-dynamic', 'original', true); } else { $this->setMeta('data-dynamic', 'clone', true); $this->setMeta("class", "vf__clone"); } } $strId = ($intCount == 0) ? " id=\"{$this->getId()}\"" : ""; $strOutput = "<fieldset{$this->__getMetaString()}{$strId}>\n"; if ($this->__active) { $strCounter = ($intCount == 0 && $this->__dynamic) ? " <input type='hidden' name='{$strName}_dynamic' value='{$intCount}' id='{$strName}_dynamic'/>" : ""; $label = "<label for=\"{$strName}\"><input type=\"checkbox\" name=\"{$strName}\" id=\"{$strName}\"{$this->__getFieldMetaString()} /> {$this->__label}{$strCounter}</label>"; } else { $label = $this->__label; } if (! empty($this->__label)) { $strOutput .= "<legend>{$label}</legend>\n"; } foreach ($this->__fields as $objField) { if (($intCount > 0) && get_class($objField) == "ValidFormBuilder\\Hidden" && $objField->isDynamicCounter()) { continue; } // $submitted = ($this->__active && !$blnHasContent) ? FALSE : $submitted; $strOutput .= $objField->__toHtml($submitted, $blnSimpleLayout, $blnLabel, $blnDisplayErrors, $intCount); } if ($this->isRemovable()) { $this->setMeta("dynamicRemoveLabelClass", "vf__removeLabel"); $strOutput .= $this->getRemoveLabelHtml(); } $strOutput .= "</fieldset>\n"; if ($intCount == $this->getDynamicCount()) { $strOutput .= $this->getDynamicHtml($intCount); } return $strOutput; }
Same as {@link \ValidFormBuilder\Area::toHtml()} but with dynamic counter as extra parameter @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 @param integer $intCount The dynamic count of this area @return string Rendered Area
entailment
protected function getDynamicHtml($intCount = 0) { $strReturn = ""; if ($this->__dynamic && ! empty($this->__dynamicLabel)) { $arrFields = array(); // Generate an array of field id's foreach ($this->__fields as $field) { switch (get_class($field)) { case "ValidFormBuilder\\MultiField": /* @var $subField Element */ foreach ($field->getFields() as $subField) { // Skip the hidden dynamic counter fields. if ((get_class($subField) == "ValidFormBuilder\\Hidden") && $subField->isDynamicCounter()) { continue; } if (!empty($field->getName())) { $arrFields[$subField->getId()] = $subField->getName(); } } break; default: // Skip the hidden dynamic counter fields. if ((get_class($field) == "ValidFormBuilder\\Hidden") && $field->isDynamicCounter()) { continue; } if (!empty($field->getName())) { $arrFields[$field->getId()] = $field->getName(); } break; } } //*** Store the active area's checkbox in the dynamic fields array as well $areaName = ($intCount == 0) ? $this->getName() : $this->getName() . "_" . $intCount; if ($this->__active) { $arrFields[$areaName] = $areaName; } $strReturn .= "<div class=\"vf__dynamic\"{$this->getDynamicButtonMeta()}>"; $strReturn .= "<a href=\"#\" data-target-id=\"" . implode("|", array_keys(array_filter($arrFields))) . "\" data-target-name=\"" . implode("|", array_values(array_filter($arrFields))) . "\"{$this->__getDynamicLabelMetaString()}>{$this->__dynamicLabel}</a>"; $strReturn .= "</div>"; } return $strReturn; }
Generate extra HTML output to facilitate the dynamic duplication logic @param int $intCount @return string
entailment
public function toJS($intDynamicPosition = 0) { $strReturn = ""; foreach ($this->__fields as $field) { $strReturn .= $field->toJS($this->__dynamic); } $strReturn .= $this->conditionsToJs($intDynamicPosition); return $strReturn; }
Generate Javascript code. See {@link \ValidFormBuilder\Base::toJs() Base::toJs()} @param integer $intDynamicPosition The dynamic position counter @return string Generated javascript code
entailment
public function isValid() { $blnReturn = true; $intDynamicCount = $this->getDynamicCount(); for ($intCount = 0; $intCount <= $intDynamicCount; $intCount ++) { $blnReturn = $this->__validate($intCount); if (! $blnReturn) { break; } } return $blnReturn; }
Verify if all submitted data of this area and it's children is valid. @return boolean
entailment
public function getDynamicCount() { $intReturn = 0; if ($this->__dynamic) { $objCounters = $this->getCountersRecursive($this->getFields()); foreach ($objCounters as $objCounter) { $intCounterValue = $objCounter->getValidator()->getValue(); if ($intCounterValue > $intReturn) { $intReturn = $intCounterValue; } } if ($intReturn > 0) { // Equalize all counter values inside this area foreach ($objCounters as $objCounter) { $objCounter->setDefault($intReturn); } } } return $intReturn; }
Get the dynamic counter value if this is an dynamic area. @return integer Defaults to 0 if not an dynamic area. If dynamic, this returns the number of times the user duplicated this area.
entailment
public function getValue($intCount = null) { $strName = ($intCount > 0) ? $this->__name . "_" . $intCount : $this->__name; $value = ValidForm::get($strName); return (($this->__active && ! empty($value)) || ! $this->__active) ? true : false; }
If this is an active area, this will return the value of the checkbox. @param string $intCount Dynamic counter, defaults to null @return boolean
entailment
private function __validate($intCount = null) { $blnReturn = true; foreach ($this->__fields as $field) { // Note: hasContent is only accurate if isValid() is called first ... if (! $field->isValid($intCount)) { $blnReturn = false; break; } } // ... therefore, check if the area is empty after validation of all the fields. if ($this->__active && ! $this->hasContent($intCount)) { $blnReturn = true; } return $blnReturn; }
Validate this Area and it's children's submitted values @param string $intCount The dynamic counter @return boolean True if Area and children are valid, false if not.
entailment
public function render($tpl, array $vars = array(), array $cookies = array()) { Logger::log('Start render response'); $vars = ResponseHelper::setDebugHeaders($vars); $output = $this->dump($tpl, $vars); return $this->output($output, 'text/html', $cookies); }
Método que procesa la plantilla @param string $tpl @param array $vars @param array $cookies @return string HTML
entailment
public function addPath($path, $domain = '') { $this->tpl->getLoader()->addPath($path, $domain); return $this; }
Método que añade una nueva ruta al path de Twig @param $path @param $domain @return Template
entailment
public function dump($tpl, array $vars = array()) { $vars['__user__'] = Security::getInstance()->getUser(); $vars['__admin__'] = Security::getInstance()->getAdmin(); $vars['__profiles__'] = Security::getCleanProfiles(); $vars['__flash__'] = Security::getInstance()->getFlashes(); $vars['__get__'] = Request::getInstance()->getQueryParams(); $vars['__post__'] = Request::getInstance()->getData(); $dump = ''; try { $dump = $this->tpl->render($tpl, $vars); } catch (\Exception $e) { Logger::log($e->getMessage(), LOG_ERR); } return $dump; }
Método que devuelve el contenido de una plantilla @param string $tpl @param array $vars @return string
entailment
protected function addTemplateFunction($templateFunction, $functionName) { $function = new TwigFunction($templateFunction, $functionName); $this->tpl->addFunction($function); return $this; }
Método que añade una función al motor de plantillas @param string $templateFunction @param $functionName @return Template
entailment
public function regenerateTemplates() { $this->generateTemplatesCache(); $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, true); $translations = []; if (is_array($domains)) { $translations = $this->parsePathTranslations($domains); } $translations[] = t('Plantillas regeneradas correctamente'); return $translations; }
Servicio que regenera todas las plantillas @return array
entailment
protected function generateTemplate($tplDir, $domain = '') { $templatesDir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($tplDir), \RecursiveIteratorIterator::LEAVES_ONLY); foreach ($templatesDir as $file) { // force compilation if ($file->isFile()) { try { $this->tpl->load(str_replace($tplDir . '/', '', $file)); } catch (\Exception $e) { Logger::log($e->getMessage(), LOG_ERR, ['file' => $e->getFile(), 'line' => $e->getLine()]); } } } return str_replace('%d', $domain, str_replace('%s', $tplDir, t('Generando plantillas en path "%s" para el dominio "%d"'))); }
@param $tplDir @param string $domain @return mixed
entailment
public static function extractPath($path) { $explodePath = explode(DIRECTORY_SEPARATOR, $path); $realPath = array(); for ($i = 0, $parts = count($explodePath) - 1; $i < $parts; $i++) { $realPath[] = $explodePath[$i]; } return implode(DIRECTORY_SEPARATOR, $realPath); }
Método que extrae el path de un string @param $path @return string
entailment
static public function getDomains($append = false) { $domains = Router::getInstance()->getDomains(); if ($append) { foreach ($domains as &$domain) { foreach ($domain as &$path) { $path .= DIRECTORY_SEPARATOR; } } } return $domains; }
Método que devuelve los dominios de una plataforma @param bool $append @return array
entailment
private function addTemplateFunctions() { //Asignamos las funciones especiales $functions = [ 'asset' => TemplateFunctions::ASSETS_FUNCTION, 'form' => TemplateFunctions::FORM_FUNCTION, 'form_widget' => TemplateFunctions::WIDGET_FUNCTION, 'form_button' => TemplateFunctions::BUTTON_FUNCTION, 'get_config' => TemplateFunctions::CONFIG_FUNCTION, 'path' => TemplateFunctions::ROUTE_FUNCTION, 'resource' => TemplateFunctions::RESOURCE_FUNCTION, 'session' => TemplateFunctions::SESSION_FUNCTION, 'existsFlash' => TemplateFunctions::EXISTS_FLASH_FUNCTION, 'getFlash' => TemplateFunctions::GET_FLASH_FUNCTION, 'getQuery' => TemplateFunctions::GET_QUERY_FUNCTION, ]; foreach($functions as $name => $function) { $this->addTemplateFunction($name, $function); } }
Método que añade todas las funciones de las plantillas
entailment
private function loadDomains() { $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, true); if (null !== $domains) { foreach ($domains as $domain => $paths) { $this->addPath($paths['template'], preg_replace('/(@|\/)/', '', $domain)); } } }
Method that extract all domains for using them with the templates
entailment
private function setup() { $loader = new FilesystemLoader(GeneratorHelper::getTemplatePath()); $this->tpl = new Environment($loader, array( 'cache' => CACHE_DIR . DIRECTORY_SEPARATOR . 'twig', 'debug' => (bool)$this->debug, 'auto_reload' => Config::getParam('twig.autoreload', TRUE), )); $this->loadDomains(); }
Método que inicializa el motor de plantillas
entailment
private function parsePathTranslations($domains) { $translations = array(); if (!empty($domains)) { foreach ($domains as $domain => $paths) { if (strlen($domain) && array_key_exists('template', $paths)) { $this->addPath($paths['template'], $domain); $translations[] = $this->generateTemplate($paths['template'], $domain); } } } return $translations; }
Method that extract all path tag for extracting translations @param array $domains @return array
entailment
private function generateTemplatesCache() { /** @var \Twig_Loader_Filesystem $loader */ $loader = $this->tpl->getLoader(); $availablePaths = $loader->getPaths(); if (!empty($availablePaths)) { foreach ($availablePaths as $path) { $this->generateTemplate($path); } } }
Method that generate all template caches
entailment
public function setLetterType($letterType): PostageInfo { if (!in_array($letterType, Envelope::getLetterTypeOptions())) { throw new InvalidArgumentException( sprintf('Property %s is not supported for %s', $letterType, __FUNCTION__) ); } $this->letter['type'] = $letterType; return $this; }
Set the letter type @param string $letterType @return self @throws InvalidArgumentException
entailment
public function deleteFleetsFleetIdMembersMemberId($fleetId, $memberId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { $this->deleteFleetsFleetIdMembersMemberIdWithHttpInfo($fleetId, $memberId, $datasource, $token, $userAgent, $xUserAgent); }
Operation deleteFleetsFleetIdMembersMemberId Kick fleet member @param int $fleetId ID for a fleet (required) @param int $memberId The character ID of a member in this fleet (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 void
entailment
public function deleteFleetsFleetIdMembersMemberIdAsync($fleetId, $memberId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->deleteFleetsFleetIdMembersMemberIdAsyncWithHttpInfo($fleetId, $memberId, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation deleteFleetsFleetIdMembersMemberIdAsync Kick fleet member @param int $fleetId ID for a fleet (required) @param int $memberId The character ID of a member in this fleet (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 deleteFleetsFleetIdMembersMemberIdAsyncWithHttpInfo($fleetId, $memberId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { $returnType = ''; $request = $this->deleteFleetsFleetIdMembersMemberIdRequest($fleetId, $memberId, $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 deleteFleetsFleetIdMembersMemberIdAsyncWithHttpInfo Kick fleet member @param int $fleetId ID for a fleet (required) @param int $memberId The character ID of a member in this fleet (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 deleteFleetsFleetIdSquadsSquadId($fleetId, $squadId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { $this->deleteFleetsFleetIdSquadsSquadIdWithHttpInfo($fleetId, $squadId, $datasource, $token, $userAgent, $xUserAgent); }
Operation deleteFleetsFleetIdSquadsSquadId Delete fleet squad @param int $fleetId ID for a fleet (required) @param int $squadId The squad 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 \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return void
entailment
public function deleteFleetsFleetIdSquadsSquadIdAsync($fleetId, $squadId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->deleteFleetsFleetIdSquadsSquadIdAsyncWithHttpInfo($fleetId, $squadId, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation deleteFleetsFleetIdSquadsSquadIdAsync Delete fleet squad @param int $fleetId ID for a fleet (required) @param int $squadId The squad 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 deleteFleetsFleetIdWingsWingId($fleetId, $wingId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { $this->deleteFleetsFleetIdWingsWingIdWithHttpInfo($fleetId, $wingId, $datasource, $token, $userAgent, $xUserAgent); }
Operation deleteFleetsFleetIdWingsWingId Delete fleet wing @param int $fleetId ID for a fleet (required) @param int $wingId The wing 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 \nullx27\ESI\ApiException on non-2xx response @throws \InvalidArgumentException @return void
entailment
public function deleteFleetsFleetIdWingsWingIdAsync($fleetId, $wingId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->deleteFleetsFleetIdWingsWingIdAsyncWithHttpInfo($fleetId, $wingId, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation deleteFleetsFleetIdWingsWingIdAsync Delete fleet wing @param int $fleetId ID for a fleet (required) @param int $wingId The wing 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 getCharactersCharacterIdFleet($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getCharactersCharacterIdFleetWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent); return $response; }
Operation getCharactersCharacterIdFleet Get character fleet info @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\GetCharactersCharacterIdFleetOk
entailment
public function getCharactersCharacterIdFleetAsync($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getCharactersCharacterIdFleetAsyncWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getCharactersCharacterIdFleetAsync Get character fleet info @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 getFleetsFleetIdAsync($fleetId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getFleetsFleetIdAsyncWithHttpInfo($fleetId, $datasource, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getFleetsFleetIdAsync Get fleet information @param int $fleetId ID for a fleet (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 getFleetsFleetIdMembers($fleetId, $datasource = 'tranquility', $language = 'en-us', $token = null, $userAgent = null, $xUserAgent = null) { list($response) = $this->getFleetsFleetIdMembersWithHttpInfo($fleetId, $datasource, $language, $token, $userAgent, $xUserAgent); return $response; }
Operation getFleetsFleetIdMembers Get fleet members @param int $fleetId ID for a fleet (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $language Language to use in the response (optional, default to en-us) @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\GetFleetsFleetIdMembers200Ok[]
entailment
public function getFleetsFleetIdMembersAsync($fleetId, $datasource = 'tranquility', $language = 'en-us', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getFleetsFleetIdMembersAsyncWithHttpInfo($fleetId, $datasource, $language, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getFleetsFleetIdMembersAsync Get fleet members @param int $fleetId ID for a fleet (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $language Language to use in the response (optional, default to en-us) @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 getFleetsFleetIdWingsAsync($fleetId, $datasource = 'tranquility', $language = 'en-us', $token = null, $userAgent = null, $xUserAgent = null) { return $this->getFleetsFleetIdWingsAsyncWithHttpInfo($fleetId, $datasource, $language, $token, $userAgent, $xUserAgent) ->then( function ($response) { return $response[0]; } ); }
Operation getFleetsFleetIdWingsAsync Get fleet wings @param int $fleetId ID for a fleet (required) @param string $datasource The server name you would like data from (optional, default to tranquility) @param string $language Language to use in the response (optional, default to en-us) @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