sentence1
stringlengths 52
3.87M
| sentence2
stringlengths 1
47.2k
| label
stringclasses 1
value |
---|---|---|
public function postUiOpenwindowContract($contractId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
$this->postUiOpenwindowContractWithHttpInfo($contractId, $datasource, $token, $userAgent, $xUserAgent);
} | Operation postUiOpenwindowContract
Open Contract Window
@param int $contractId The contract to open (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 postUiOpenwindowContractAsync($contractId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->postUiOpenwindowContractAsyncWithHttpInfo($contractId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation postUiOpenwindowContractAsync
Open Contract Window
@param int $contractId The contract to open (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 postUiOpenwindowContractAsyncWithHttpInfo($contractId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
$returnType = '';
$request = $this->postUiOpenwindowContractRequest($contractId, $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 postUiOpenwindowContractAsyncWithHttpInfo
Open Contract Window
@param int $contractId The contract to open (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 postUiOpenwindowInformation($targetId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
$this->postUiOpenwindowInformationWithHttpInfo($targetId, $datasource, $token, $userAgent, $xUserAgent);
} | Operation postUiOpenwindowInformation
Open Information Window
@param int $targetId The target to open (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 postUiOpenwindowInformationAsync($targetId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->postUiOpenwindowInformationAsyncWithHttpInfo($targetId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation postUiOpenwindowInformationAsync
Open Information Window
@param int $targetId The target to open (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 postUiOpenwindowInformationAsyncWithHttpInfo($targetId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
$returnType = '';
$request = $this->postUiOpenwindowInformationRequest($targetId, $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 postUiOpenwindowInformationAsyncWithHttpInfo
Open Information Window
@param int $targetId The target to open (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 postUiOpenwindowMarketdetailsAsync($typeId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->postUiOpenwindowMarketdetailsAsyncWithHttpInfo($typeId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation postUiOpenwindowMarketdetailsAsync
Open Market Details
@param int $typeId The item type to open in market window (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 postUiOpenwindowMarketdetailsAsyncWithHttpInfo($typeId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
$returnType = '';
$request = $this->postUiOpenwindowMarketdetailsRequest($typeId, $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 postUiOpenwindowMarketdetailsAsyncWithHttpInfo
Open Market Details
@param int $typeId The item type to open in market window (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 postUiOpenwindowNewmail($newMail, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
$this->postUiOpenwindowNewmailWithHttpInfo($newMail, $datasource, $token, $userAgent, $xUserAgent);
} | Operation postUiOpenwindowNewmail
Open New Mail Window
@param \nullx27\ESI\nullx27\ESI\Models\PostUiOpenwindowNewmailNewMail $newMail The details of mail to create (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 postUiOpenwindowNewmailAsync($newMail, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->postUiOpenwindowNewmailAsyncWithHttpInfo($newMail, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation postUiOpenwindowNewmailAsync
Open New Mail Window
@param \nullx27\ESI\nullx27\ESI\Models\PostUiOpenwindowNewmailNewMail $newMail The details of mail to create (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 postUiOpenwindowNewmailAsyncWithHttpInfo($newMail, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
$returnType = '';
$request = $this->postUiOpenwindowNewmailRequest($newMail, $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 postUiOpenwindowNewmailAsyncWithHttpInfo
Open New Mail Window
@param \nullx27\ESI\nullx27\ESI\Models\PostUiOpenwindowNewmailNewMail $newMail The details of mail to create (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 getWarsAsync($datasource = 'tranquility', $maxWarId = null, $userAgent = null, $xUserAgent = null)
{
return $this->getWarsAsyncWithHttpInfo($datasource, $maxWarId, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getWarsAsync
List wars
@param string $datasource The server name you would like data from (optional, default to tranquility)
@param int $maxWarId Only return wars with ID smaller than this. (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 getWarsWarId($warId, $datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getWarsWarIdWithHttpInfo($warId, $datasource, $userAgent, $xUserAgent);
return $response;
} | Operation getWarsWarId
Get war information
@param int $warId ID for a war (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\GetWarsWarIdOk | entailment |
public function getWarsWarIdAsync($warId, $datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
return $this->getWarsWarIdAsyncWithHttpInfo($warId, $datasource, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getWarsWarIdAsync
Get war information
@param int $warId ID for a war (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 getWarsWarIdKillmailsAsync($warId, $datasource = 'tranquility', $page = '1', $userAgent = null, $xUserAgent = null)
{
return $this->getWarsWarIdKillmailsAsyncWithHttpInfo($warId, $datasource, $page, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getWarsWarIdKillmailsAsync
List kills for a war
@param int $warId A valid war 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 $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 acquire($key)
{
$this->assertNotAcquired($key);
return $this->storage->save($key, $this->ttl);
} | {@inheritdoc} | entailment |
public function refresh($key)
{
$this->assertAcquired($key);
return $this->storage->save($key, $this->ttl);
} | {@inheritdoc} | entailment |
public function listInvalidProperties()
{
$invalidProperties = [];
if (!is_null($this->container['currentRank']) && ($this->container['currentRank'] > 9)) {
$invalidProperties[] = "invalid value for 'currentRank', must be smaller than or equal to 9.";
}
if (!is_null($this->container['currentRank']) && ($this->container['currentRank'] < 0)) {
$invalidProperties[] = "invalid value for 'currentRank', must be bigger than or equal to 0.";
}
if (!is_null($this->container['highestRank']) && ($this->container['highestRank'] > 9)) {
$invalidProperties[] = "invalid value for 'highestRank', must be smaller than or equal to 9.";
}
if (!is_null($this->container['highestRank']) && ($this->container['highestRank'] < 0)) {
$invalidProperties[] = "invalid value for 'highestRank', must be bigger than or equal to 0.";
}
if ($this->container['kills'] === null) {
$invalidProperties[] = "'kills' can't be null";
}
if ($this->container['victoryPoints'] === null) {
$invalidProperties[] = "'victoryPoints' can't be null";
}
return $invalidProperties;
} | Show all the invalid properties with reasons.
@return array invalid properties with reasons | entailment |
public function setCurrentRank($currentRank)
{
if (!is_null($currentRank) && ($currentRank > 9)) {
throw new \InvalidArgumentException('invalid value for $currentRank when calling GetCharactersCharacterIdFwStatsOk., must be smaller than or equal to 9.');
}
if (!is_null($currentRank) && ($currentRank < 0)) {
throw new \InvalidArgumentException('invalid value for $currentRank when calling GetCharactersCharacterIdFwStatsOk., must be bigger than or equal to 0.');
}
$this->container['currentRank'] = $currentRank;
return $this;
} | Sets currentRank
@param int $currentRank The given character's current faction rank
@return $this | entailment |
public function setHighestRank($highestRank)
{
if (!is_null($highestRank) && ($highestRank > 9)) {
throw new \InvalidArgumentException('invalid value for $highestRank when calling GetCharactersCharacterIdFwStatsOk., must be smaller than or equal to 9.');
}
if (!is_null($highestRank) && ($highestRank < 0)) {
throw new \InvalidArgumentException('invalid value for $highestRank when calling GetCharactersCharacterIdFwStatsOk., must be bigger than or equal to 0.');
}
$this->container['highestRank'] = $highestRank;
return $this;
} | Sets highestRank
@param int $highestRank The given character's highest faction rank achieved
@return $this | entailment |
public function getMarketsGroupsMarketGroupId($marketGroupId, $datasource = null, $language = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getMarketsGroupsMarketGroupIdWithHttpInfo($marketGroupId, $datasource, $language, $userAgent, $xUserAgent);
return $response;
} | Operation getMarketsGroupsMarketGroupId
Get item group information
@param int $marketGroupId An Eve item group ID (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 $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\GetMarketsGroupsMarketGroupIdOk | entailment |
public function getMarketsRegionIdHistory($regionId, $typeId, $datasource = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getMarketsRegionIdHistoryWithHttpInfo($regionId, $typeId, $datasource, $userAgent, $xUserAgent);
return $response;
} | Operation getMarketsRegionIdHistory
List historical market statistics in a region
@param int $regionId Return statistics in this region (required)
@param int $typeId Return statistics for this type (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\GetMarketsRegionIdHistory200Ok[] | entailment |
public function getMarketsRegionIdOrders($orderType, $regionId, $datasource = null, $page = null, $typeId = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getMarketsRegionIdOrdersWithHttpInfo($orderType, $regionId, $datasource, $page, $typeId, $userAgent, $xUserAgent);
return $response;
} | Operation getMarketsRegionIdOrders
List orders in a region
@param string $orderType Filter buy/sell orders, return all orders by default. If you query without type_id, we always return both buy and sell orders. (required)
@param int $regionId Return orders in this region (required)
@param string $datasource The server name you would like data from (optional, default to tranquility)
@param int $page Which page to query, only used for querying without type_id. Starting at 1 (optional, default to 1)
@param int $typeId Return orders only for this type (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\GetMarketsRegionIdOrders200Ok[] | entailment |
public function getValidValue($intDynamicPosition = 0)
{
$varReturn = null;
if (isset($this->__validvalues[$intDynamicPosition])) {
$varReturn = $this->__validvalues[$intDynamicPosition];
}
return $varReturn;
} | Get the validated value
@param integer $intDynamicPosition
@return array|string | entailment |
public function getValue($intDynamicPosition = 0)
{
$varReturn = null;
if (isset($this->__overrideerrors[$intDynamicPosition]) && empty($this->__overrideerrors[$intDynamicPosition])) {
$varReturn = null;
} else {
$strFieldName = ($intDynamicPosition > 0) ? $this->__fieldname . "_" . $intDynamicPosition : $this->__fieldname;
//if ($this->__type !== ValidForm::VFORM_FILE) {
// Default value
$varValidValue = $this->__field->getDefault();
if (is_array($varValidValue) && isset($varValidValue[$intDynamicPosition])) {
$varValidValue = $varValidValue[$intDynamicPosition];
}
// Get cached value if set
if (isset($this->__validvalues[$intDynamicPosition])) {
$varValidValue = $this->__validvalues[$intDynamicPosition];
}
// Overwrite cached value with value from REQUEST array if available
if (ValidForm::getIsSet($strFieldName)) {
$varValue = ValidForm::get($strFieldName);
if (is_array($varValue)) {
$varReturn = [];
foreach ($varValue as $key => $value) {
$varReturn[$key] = $value; // NEVER return unsanitized output
}
} else {
$varReturn = $varValue; // NEVER return unsanitized output
}
} else {
$varReturn = $varValidValue;
}
//}
// *** Not ready for implementation yet.
// else {
// if (isset($_FILES[$strFieldName]) && isset($_FILES[$strFieldName])) {
// $varReturn = $_FILES[$strFieldName];
// }
// }
}
return $varReturn;
} | Get the value to validate from either the global request variable or the cached __validvalues array.
@param integer $intDynamicPosition Using the intDynamicPosition parameter, you can get the specific value
of a dynamic field.
@return string|array|null Returns the submitted field value. If no sumitted value is set,
return value is the cached valid value. If no cached value is set, return value is the default value. If no
default value is set, return value is null. When field type is `ValidForm::VFORM_FILE` and a file is submitted,
the return value is the `$_FILES[fieldname]` array. | entailment |
public function validate($intDynamicPosition = 0)
{
// Reset the internal errors array
$this->__errors = array();
// *** Get the value to validate from either the global request variable or the cached __validvalues array.
$value = $this->getValue($intDynamicPosition);
// *** Get required an visible states from condition and overwrite values for validation purposes
$objCondition = $this->__field->getConditionRecursive("required");
if (is_object($objCondition)) {
if ($objCondition->isMet($intDynamicPosition)) {
$this->__required = $objCondition->getValue();
} else {
$this->__required = ! $objCondition->getValue();
}
}
$objCondition = $this->__field->getConditionRecursive("enabled");
if (is_object($objCondition)) {
if ($objCondition->isMet($intDynamicPosition)) {
$this->__required = ($objCondition->getValue()) ? $this->__required : false;
} else {
$this->__required = ($objCondition->getValue()) ? false : $this->__required;
}
}
$objCondition = $this->__field->getConditionRecursive("visible");
if (is_object($objCondition)) {
if ($objCondition->isMet($intDynamicPosition)) {
$this->__required = ($objCondition->getValue()) ? $this->__required : false;
} else {
$this->__required = ($objCondition->getValue()) ? false : $this->__required;
}
}
// Check if parent element is an area.
// If so, check if it's an active area that is selected
$objParent = $this->__field->getMeta("parent", null);
if (! is_null($objParent) && get_class($objParent) === "ValidFormBuilder\\Area") {
if ($objParent->isActive() && ! $objParent->getValue($intDynamicPosition)) {
$this->__required = false;
}
}
// *** Check "required" option.
if (is_array($value)) {
$blnEmpty = true;
$intCount = 0;
foreach ($value as $valueItem) {
if (strlen($valueItem) > 0) {
$blnEmpty = false;
break;
}
$intCount ++;
}
if ($blnEmpty) {
if ($this->__required) {
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = $this->__requirederror;
} else {
$this->__validvalues[$intDynamicPosition] = "";
return true;
}
}
} elseif (strlen($value) == 0) {
if (($this->__required && $intDynamicPosition == 0) || !!$this->__field->getMeta('dynamicRemoveLabel', false)) {
// *** Only the first dynamic field has a required check. We asume by design that "real" dynamic fields are not required.
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = $this->__requirederror;
} else {
unset($this->__validvalues[$intDynamicPosition]);
if (empty($this->__matchwith)) {
return true;
}
}
}
// *** Check if value is_null and not required. No other checks needed.
if (! $this->__required && is_null($value)) {
return true;
}
// *** Check if value is hint value.
if (! $this->__hasError($intDynamicPosition)) {
$strHint = $this->__field->getHint();
if (! empty($strHint) && ! is_array($value)) {
if ($strHint == $value) {
if ($this->__required) {
// *** If required then it's an error.
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = $this->__hinterror;
} else {
// *** If optional then empty value and return true.
unset($this->__validvalues[$intDynamicPosition]);
return true;
}
}
}
}
// *** Check minimum input length.
if (! $this->__hasError($intDynamicPosition)) {
if ($this->__minlength > 0 && is_array($value)) {
if (count($value) < $this->__minlength) {
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = sprintf($this->__minlengtherror, $this->__minlength);
}
} elseif ($this->__minlength > 0 && strlen($value) < $this->__minlength) {
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = sprintf($this->__minlengtherror, $this->__minlength);
}
}
// *** Check maximum input length.
if (! $this->__hasError($intDynamicPosition)) {
if ($this->__maxlength > 0 && is_array($value)) {
if (count($value) > $this->__maxlength) {
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = sprintf($this->__maxlengtherror, $this->__maxlength);
}
} elseif ($this->__maxlength > 0 && strlen($value) > $this->__maxlength) {
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = sprintf($this->__maxlengtherror, $this->__maxlength);
}
}
// *** Check matching values.
if (! $this->__hasError($intDynamicPosition)) {
if (! empty($this->__matchwith)) {
$matchValue = $this->__matchwith->getValue();
if (empty($matchValue)) {
$matchValue = null;
}
if (empty($value)) {
$value = null;
}
if ($matchValue !== $value) {
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = $this->__matchwitherror;
} elseif (is_null($value)) {
return true;
}
}
}
// *** Check specific types.
if (! $this->__hasError($intDynamicPosition)) {
if (!empty($this->__validation)) {
$blnValidType = Validator::validate($this->__validation, $value);
} else {
$blnValidType = Validator::validate($this->__field->getType(), $value);
}
if (! $blnValidType) {
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = $this->__typeerror;
} else {
if (is_array($value) && is_array($value[0])) {
//*** Set the value directly when the value is a nested array.
$this->__validvalues = $value;
} else {
$this->__validvalues[$intDynamicPosition] = $value;
}
}
}
// *** Override error.
if (isset($this->__overrideerrors[$intDynamicPosition]) && ! empty($this->__overrideerrors[$intDynamicPosition])) {
unset($this->__validvalues[$intDynamicPosition]);
$this->__errors[$intDynamicPosition] = $this->__overrideerrors[$intDynamicPosition];
}
return (!isset($this->__validvalues[$intDynamicPosition])) ? false : true;
} | The most important function of ValidForm Builder library.
This function handles all the server-side field validation logic.
@param integer $intDynamicPosition Using the intDynamicPosition parameter, you can validate a specific dynamic
field, if necessary.
@return boolean True if the current field validates, false if not. | entailment |
public function getError($intDynamicPosition = 0)
{
$strReturn = "";
if (isset($this->__errors[$intDynamicPosition]) && !empty($this->__errors[$intDynamicPosition])) {
$strReturn = $this->__errors[$intDynamicPosition];
}
return $strReturn;
} | Get error message
@param integer $intDynamicPosition
@return string | entailment |
public function getCheck()
{
if (!empty($this->__validation)) {
$strReturn = $this->__validation;
} else {
$strReturn = Validator::getCheck($this->__field->getType());
}
return $strReturn;
} | Get the validation rule (regular expression)
@return string | entailment |
private function __hasError($intDynamicPosition = 0)
{
return (isset($this->__errors[$intDynamicPosition]) && ! empty($this->__errors[$intDynamicPosition]));
} | Check if an error has occured
@param integer $intDynamicPosition
@return boolean | entailment |
public static function checkCORS()
{
Logger::log('Checking CORS');
$corsEnabled = Config::getParam('cors.enabled');
$request = Request::getInstance();
if (NULL !== $corsEnabled) {
if ($corsEnabled === '*' || preg_match($corsEnabled, $request->getServer('HTTP_REFERER'))) {
if (!headers_sent()) {
// TODO include this headers in Template class output method
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Origin: ' . Request::getInstance()->getServer('HTTP_ORIGIN', '*'));
header('Vary: Origin');
header('Access-Control-Allow-Methods: GET, POST, DELETE, PUT, PATCH, OPTIONS');
header('Access-Control-Allow-Headers: ' . implode(', ', self::getCorsHeaders()));
}
if (Request::getInstance()->getMethod() === Request::VERB_OPTIONS) {
Logger::log('Returning OPTIONS header confirmation for CORS pre flight requests', LOG_DEBUG);
header('HTTP/1.1 200 OK');
exit();
}
}
}
} | Check CROS requests | entailment |
public static function validateIpAddress($ipAddress) {
if (strtolower($ipAddress) === 'unknown') {
return false;
}
// generate ipv4 network address
$ipAddress = ip2long($ipAddress);
// if the ip is set and not equivalent to 255.255.255.255
if ($ipAddress !== false && $ipAddress !== -1) {
// make sure to get unsigned long representation of ip
// due to discrepancies between 32 and 64 bit OSes and
// signed numbers (ints default to signed in PHP)
$ipAddress = sprintf('%u', $ipAddress);
// do private network range checking
if ($ipAddress >= 0 && $ipAddress <= 50331647) {
return false;
}
if ($ipAddress >= 167772160 && $ipAddress <= 184549375) {
return false;
}
if ($ipAddress >= 2130706432 && $ipAddress <= 2147483647) {
return false;
}
if ($ipAddress >= 2851995648 && $ipAddress <= 2852061183) {
return false;
}
if ($ipAddress >= 2886729728 && $ipAddress <= 2887778303) {
return false;
}
if ($ipAddress >= 3221225984 && $ipAddress <= 3221226239) {
return false;
}
if ($ipAddress >= 3232235520 && $ipAddress <= 3232301055) {
return false;
}
if ($ipAddress >= 4294967040) {
return false;
}
}
return true;
} | Ensures an ip address is both a valid IP and does not fall within
a private network range. | entailment |
public function init()
{
Logger::log('Dispatcher init');
parent::init();
$this->initiateStats();
I18nHelper::setLocale();
$this->bindWarningAsExceptions();
$this->actualUri = Request::getInstance()->getServer('REQUEST_URI');
Logger::log('End dispatcher init');
} | Initializer method | entailment |
public function run($uri = null)
{
Logger::log('Begin runner');
try {
if ($this->config->isConfigured()) {
//Check CORS for requests
RequestHelper::checkCORS();
if (!Request::getInstance()->isFile()) {
return $this->router->execute($uri ?: $this->actualUri);
}
} else {
return ConfigController::getInstance()->config();
}
} catch (AdminCredentialsException $a) {
return UserController::showAdminManager();
} catch (SecurityException $s) {
return $this->security->notAuthorized($this->actualUri);
} catch (RouterException $r) {
return $this->router->httpNotFound($r);
} catch(ApiException $a) {
return $this->router->httpNotFound($a, true);
} catch (\Exception $e) {
return $this->dumpException($e);
}
} | Run method
@param string $uri
@return string HTML | entailment |
protected function dumpException(\Exception $e)
{
Logger::log('Starting dump exception');
$ex = (NULL !== $e->getPrevious()) ? $e->getPrevious() : $e;
$error = array(
"error" => $ex->getMessage(),
"file" => $ex->getFile(),
"line" => $ex->getLine(),
);
Logger::log('Throwing exception', LOG_ERR, $error);
unset($error);
return $this->router->httpNotFound($ex);
} | Method that convert an exception to html
@param \Exception $e
@return string HTML | entailment |
public function getColorAllowableValues()
{
return [
self::COLOR_FFFFFF,
self::COLOR_FFFF01,
self::COLOR_FF6600,
self::COLOR_FE0000,
self::COLOR__9A0000,
self::COLOR__660066,
self::COLOR__0000FE,
self::COLOR__0099FF,
self::COLOR__01FFFF,
self::COLOR__00FF33,
self::COLOR__349800,
self::COLOR__006634,
self::COLOR__666666,
self::COLOR__999999,
self::COLOR_E6E6E6,
self::COLOR_FFFFCD,
self::COLOR__99FFFF,
self::COLOR_CCFF9A,
];
} | Gets allowable values of the enum
@return string[] | entailment |
public function setColor($color)
{
$allowed_values = array('#ffffff', '#ffff01', '#ff6600', '#fe0000', '#9a0000', '#660066', '#0000fe', '#0099ff', '#01ffff', '#00ff33', '#349800', '#006634', '#666666', '#999999', '#e6e6e6', '#ffffcd', '#99ffff', '#ccff9a');
if (!is_null($color) && (!in_array($color, $allowed_values))) {
throw new \InvalidArgumentException("Invalid value for 'color', must be one of '#ffffff', '#ffff01', '#ff6600', '#fe0000', '#9a0000', '#660066', '#0000fe', '#0099ff', '#01ffff', '#00ff33', '#349800', '#006634', '#666666', '#999999', '#e6e6e6', '#ffffcd', '#99ffff', '#ccff9a'");
}
$this->container['color'] = $color;
return $this;
} | Sets color
@param string $color Hexadecimal string representing label color, in RGB format
@return $this | entailment |
public function contains(Address $address)
{
$addressValue = $address->get();
return $addressValue >= $this->firstAddress->get() && $addressValue <= $this->lastAddress->get();
} | Determine if a given address is contained within the range.
@param \JAAulde\IP\V4\Address $address The address we want to know about
@return bool | entailment |
public function setLinkLevel($linkLevel)
{
if (($linkLevel > 10)) {
throw new \InvalidArgumentException('invalid value for $linkLevel when calling GetCharactersCharacterIdPlanetsPlanetIdLink., must be smaller than or equal to 10.');
}
if (($linkLevel < 0)) {
throw new \InvalidArgumentException('invalid value for $linkLevel when calling GetCharactersCharacterIdPlanetsPlanetIdLink., must be bigger than or equal to 0.');
}
$this->container['linkLevel'] = $linkLevel;
return $this;
} | Sets linkLevel
@param int $linkLevel link_level integer
@return $this | entailment |
public function getCharactersCharacterIdLocation($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getCharactersCharacterIdLocationWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent);
return $response;
} | Operation getCharactersCharacterIdLocation
Get character location
@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\GetCharactersCharacterIdLocationOk | entailment |
public function getCharactersCharacterIdLocationAsync($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->getCharactersCharacterIdLocationAsyncWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getCharactersCharacterIdLocationAsync
Get character location
@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 getCharactersCharacterIdOnline($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getCharactersCharacterIdOnlineWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent);
return $response;
} | Operation getCharactersCharacterIdOnline
Get character online
@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\GetCharactersCharacterIdOnlineOk | entailment |
public function getCharactersCharacterIdOnlineAsync($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->getCharactersCharacterIdOnlineAsyncWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getCharactersCharacterIdOnlineAsync
Get character online
@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 getCharactersCharacterIdShip($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getCharactersCharacterIdShipWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent);
return $response;
} | Operation getCharactersCharacterIdShip
Get current ship
@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\GetCharactersCharacterIdShipOk | entailment |
public function getCharactersCharacterIdShipAsync($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->getCharactersCharacterIdShipAsyncWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getCharactersCharacterIdShipAsync
Get current ship
@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 getWars($datasource = null, $maxWarId = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getWarsWithHttpInfo($datasource, $maxWarId, $userAgent, $xUserAgent);
return $response;
} | Operation getWars
List wars
@param string $datasource The server name you would like data from (optional, default to tranquility)
@param int $maxWarId Only return wars with ID smaller than this. (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 int[] | entailment |
public function getWarsWarIdKillmails($warId, $datasource = null, $page = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getWarsWarIdKillmailsWithHttpInfo($warId, $datasource, $page, $userAgent, $xUserAgent);
return $response;
} | Operation getWarsWarIdKillmails
List kills for a war
@param int $warId A valid war ID (required)
@param string $datasource The server name you would like data from (optional, default to tranquility)
@param int $page Which page to query, starting at 1 (optional, default to 1)
@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\GetWarsWarIdKillmails200Ok[] | entailment |
public function logs()
{
$log = t("Selecciona un fichero de log");
$logs = $this->srv->getLogFiles();
asort($logs);
return $this->render("logs.html.twig", array(
"logs" => $logs,
"log" => $log,
));
} | Servicio que muestra los logs del sistema
@GET
@route /admin/logs
@label VIsor de logs del sistema
@visible false
@return string|null | entailment |
public function listInvalidProperties()
{
$invalid_properties = [];
if ($this->container['maxDockableShipVolume'] === null) {
$invalid_properties[] = "'maxDockableShipVolume' can't be null";
}
if ($this->container['name'] === null) {
$invalid_properties[] = "'name' can't be null";
}
if ($this->container['officeRentalCost'] === null) {
$invalid_properties[] = "'officeRentalCost' can't be null";
}
if ($this->container['reprocessingEfficiency'] === null) {
$invalid_properties[] = "'reprocessingEfficiency' can't be null";
}
if ($this->container['reprocessingStationsTake'] === null) {
$invalid_properties[] = "'reprocessingStationsTake' can't be null";
}
if ($this->container['services'] === null) {
$invalid_properties[] = "'services' can't be null";
}
if ($this->container['stationId'] === null) {
$invalid_properties[] = "'stationId' can't be null";
}
if ($this->container['systemId'] === null) {
$invalid_properties[] = "'systemId' can't be null";
}
if ($this->container['typeId'] === null) {
$invalid_properties[] = "'typeId' can't be null";
}
return $invalid_properties;
} | show all the invalid properties with reasons.
@return array invalid properties with reasons | entailment |
public function valid()
{
if ($this->container['maxDockableShipVolume'] === null) {
return false;
}
if ($this->container['name'] === null) {
return false;
}
if ($this->container['officeRentalCost'] === null) {
return false;
}
if ($this->container['reprocessingEfficiency'] === null) {
return false;
}
if ($this->container['reprocessingStationsTake'] === null) {
return false;
}
if ($this->container['services'] === null) {
return false;
}
if ($this->container['stationId'] === null) {
return false;
}
if ($this->container['systemId'] === null) {
return false;
}
if ($this->container['typeId'] === null) {
return false;
}
return true;
} | validate all the properties in the model
return true if all passed
@return bool True if all properteis are valid | entailment |
public function setServices($services)
{
$allowed_values = array('bounty-missions', 'assasination-missions', 'courier-missions', 'interbus', 'reprocessing-plant', 'refinery', 'market', 'black-market', 'stock-exchange', 'cloning', 'surgery', 'dna-therapy', 'repair-facilities', 'factory', 'labratory', 'gambling', 'fitting', 'paintshop', 'news', 'storage', 'insurance', 'docking', 'office-rental', 'jump-clone-facility', 'loyalty-point-store', 'navy-offices', 'security-offices');
if ((array_diff($services, $allowed_values))) {
throw new \InvalidArgumentException("Invalid value for 'services', must be one of 'bounty-missions', 'assasination-missions', 'courier-missions', 'interbus', 'reprocessing-plant', 'refinery', 'market', 'black-market', 'stock-exchange', 'cloning', 'surgery', 'dna-therapy', 'repair-facilities', 'factory', 'labratory', 'gambling', 'fitting', 'paintshop', 'news', 'storage', 'insurance', 'docking', 'office-rental', 'jump-clone-facility', 'loyalty-point-store', 'navy-offices', 'security-offices'");
}
$this->container['services'] = $services;
return $this;
} | Sets services
@param string[] $services services array
@return $this | entailment |
public function getCharactersCharacterIdPlanetsAsync($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->getCharactersCharacterIdPlanetsAsyncWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getCharactersCharacterIdPlanetsAsync
Get colonies
@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 getCharactersCharacterIdPlanetsPlanetId($characterId, $planetId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getCharactersCharacterIdPlanetsPlanetIdWithHttpInfo($characterId, $planetId, $datasource, $token, $userAgent, $xUserAgent);
return $response;
} | Operation getCharactersCharacterIdPlanetsPlanetId
Get colony layout
@param int $characterId An EVE character ID (required)
@param int $planetId Planet id of the target planet (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\GetCharactersCharacterIdPlanetsPlanetIdOk | entailment |
public function getCharactersCharacterIdPlanetsPlanetIdAsync($characterId, $planetId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->getCharactersCharacterIdPlanetsPlanetIdAsyncWithHttpInfo($characterId, $planetId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getCharactersCharacterIdPlanetsPlanetIdAsync
Get colony layout
@param int $characterId An EVE character ID (required)
@param int $planetId Planet id of the target planet (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 getCorporationsCorporationIdCustomsOffices($corporationId, $datasource = 'tranquility', $page = '1', $token = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getCorporationsCorporationIdCustomsOfficesWithHttpInfo($corporationId, $datasource, $page, $token, $userAgent, $xUserAgent);
return $response;
} | Operation getCorporationsCorporationIdCustomsOffices
List corporation customs offices
@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\GetCorporationsCorporationIdCustomsOffices200Ok[] | entailment |
public function getCorporationsCorporationIdCustomsOfficesAsync($corporationId, $datasource = 'tranquility', $page = '1', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->getCorporationsCorporationIdCustomsOfficesAsyncWithHttpInfo($corporationId, $datasource, $page, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getCorporationsCorporationIdCustomsOfficesAsync
List corporation customs offices
@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 getUniverseSchematicsSchematicId($schematicId, $datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getUniverseSchematicsSchematicIdWithHttpInfo($schematicId, $datasource, $userAgent, $xUserAgent);
return $response;
} | Operation getUniverseSchematicsSchematicId
Get schematic information
@param int $schematicId A PI schematic 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
@throws \InvalidArgumentException
@return \nullx27\ESI\nullx27\ESI\Models\GetUniverseSchematicsSchematicIdOk | entailment |
public function getUniverseSchematicsSchematicIdAsync($schematicId, $datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
return $this->getUniverseSchematicsSchematicIdAsyncWithHttpInfo($schematicId, $datasource, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getUniverseSchematicsSchematicIdAsync
Get schematic information
@param int $schematicId A PI schematic 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 \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface | entailment |
public function getCharactersCharacterIdFwStats($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getCharactersCharacterIdFwStatsWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent);
return $response;
} | Operation getCharactersCharacterIdFwStats
Overview of a character involved in faction warfare
@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\GetCharactersCharacterIdFwStatsOk | entailment |
public function getCharactersCharacterIdFwStatsAsync($characterId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->getCharactersCharacterIdFwStatsAsyncWithHttpInfo($characterId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getCharactersCharacterIdFwStatsAsync
Overview of a character involved in faction warfare
@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 getCorporationsCorporationIdFwStats($corporationId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getCorporationsCorporationIdFwStatsWithHttpInfo($corporationId, $datasource, $token, $userAgent, $xUserAgent);
return $response;
} | Operation getCorporationsCorporationIdFwStats
Overview of a corporation involved in faction warfare
@param int $corporationId An EVE corporation 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\GetCorporationsCorporationIdFwStatsOk | entailment |
public function getCorporationsCorporationIdFwStatsAsync($corporationId, $datasource = 'tranquility', $token = null, $userAgent = null, $xUserAgent = null)
{
return $this->getCorporationsCorporationIdFwStatsAsyncWithHttpInfo($corporationId, $datasource, $token, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getCorporationsCorporationIdFwStatsAsync
Overview of a corporation involved in faction warfare
@param int $corporationId An EVE corporation 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 getFwLeaderboards($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getFwLeaderboardsWithHttpInfo($datasource, $userAgent, $xUserAgent);
return $response;
} | Operation getFwLeaderboards
List of the top factions in faction warfare
@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\GetFwLeaderboardsOk | entailment |
public function getFwLeaderboardsAsync($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
return $this->getFwLeaderboardsAsyncWithHttpInfo($datasource, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getFwLeaderboardsAsync
List of the top factions in faction warfare
@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 getFwLeaderboardsCharacters($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getFwLeaderboardsCharactersWithHttpInfo($datasource, $userAgent, $xUserAgent);
return $response;
} | Operation getFwLeaderboardsCharacters
List of the top pilots in faction warfare
@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\GetFwLeaderboardsCharactersOk | entailment |
public function getFwLeaderboardsCharactersAsync($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
return $this->getFwLeaderboardsCharactersAsyncWithHttpInfo($datasource, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getFwLeaderboardsCharactersAsync
List of the top pilots in faction warfare
@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 getFwLeaderboardsCorporations($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getFwLeaderboardsCorporationsWithHttpInfo($datasource, $userAgent, $xUserAgent);
return $response;
} | Operation getFwLeaderboardsCorporations
List of the top corporations in faction warfare
@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\GetFwLeaderboardsCorporationsOk | entailment |
public function getFwLeaderboardsCorporationsAsync($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
return $this->getFwLeaderboardsCorporationsAsyncWithHttpInfo($datasource, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getFwLeaderboardsCorporationsAsync
List of the top corporations in faction warfare
@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 getFwStats($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getFwStatsWithHttpInfo($datasource, $userAgent, $xUserAgent);
return $response;
} | Operation getFwStats
An overview of statistics about factions involved in faction warfare
@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\GetFwStats200Ok[] | entailment |
public function getFwStatsAsync($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
return $this->getFwStatsAsyncWithHttpInfo($datasource, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getFwStatsAsync
An overview of statistics about factions involved in faction warfare
@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 getFwSystems($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getFwSystemsWithHttpInfo($datasource, $userAgent, $xUserAgent);
return $response;
} | Operation getFwSystems
Ownership of faction warfare systems
@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\GetFwSystems200Ok[] | entailment |
public function getFwSystemsAsync($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
return $this->getFwSystemsAsyncWithHttpInfo($datasource, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getFwSystemsAsync
Ownership of faction warfare systems
@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 getFwWars($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
list($response) = $this->getFwWarsWithHttpInfo($datasource, $userAgent, $xUserAgent);
return $response;
} | Operation getFwWars
Data about which NPC factions are at war
@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\GetFwWars200Ok[] | entailment |
public function getFwWarsAsync($datasource = 'tranquility', $userAgent = null, $xUserAgent = null)
{
return $this->getFwWarsAsyncWithHttpInfo($datasource, $userAgent, $xUserAgent)
->then(
function ($response) {
return $response[0];
}
);
} | Operation getFwWarsAsync
Data about which NPC factions are at war
@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 setDefaults($arrDefaults = array())
{
if (is_array($arrDefaults)) {
$this->__defaults = $arrDefaults;
} else {
throw new \InvalidArgumentException(
"Invalid argument passed in to ValidForm->setDefaults(). Expected array got " .
gettype($arrDefaults),
E_ERROR
);
}
} | Use an array to set default values on all the forms children.
The array's keys should be the form name to set the default value of, the value is the actual value
or values to set.
Example 1 - Basic defaults:
```php
//*** The form
$objCheck = $objForm->addField("cool", "Coolest PHP Library", ValidForm::VFORM_STRING);
//*** Set field 'cool' default value to "ValidForm Builder"
$objForm->setDefaults([
"cool" => "ValidForm Builder"
]);
```
Example 2 - An array of defaults:
```php
//*** The form
$objCheck = $objForm->addField("cool", "Cool checklist", ValidForm::VFORM_CHECK_LIST);
$objCheck->addField("Option 1", "option1");
$objCheck->addField("Option 2", "option2");
$objCheck->addField("Option 3", "option3");
$objCheck = $objForm->addField("cool-text", "Coolest PHP Library", ValidForm::VFORM_STRING);
//*** Check options 2 and 3 by default using setDefaults()
$objForm->setDefaults([
"cool-text" => "ValidForm Builder",
"cool" => ["option2", "option3"]
]);
```
@param array $arrDefaults The array of default values. Keys are field names, values strings or arrays
@throws \InvalidArgumentException | entailment |
public function addHtml($html, $meta = array())
{
$objString = new StaticText($html, $meta);
$this->__elements->addObject($objString);
return $objString;
} | Injects a string in the form.
Use this to add an extra string in the form. For instance, you can create an input field like this:
```
Enter the amount: $ _____
```
In this example, we used StaticText to inject the dollar sign before our input field.
@param string $html The string or HTML code to inject
@param array $meta
@return \ValidFormBuilder\StaticText | entailment |
public function addNavigation($meta = array())
{
$objNavigation = new Navigation($meta);
$this->__elements->addObject($objNavigation);
return $objNavigation;
} | Add 'navigation' to the form. By navigation we mean a 'navigation div' at the buttom of the form containing
the submit button. This method is optional for customization purposes -- navigation is created automatically.
@param array $meta Array with meta data. Only the "style" attribute is supported as for now.
@return \ValidFormBuilder\Navigation | entailment |
public function addFieldset($header = null, $noteHeader = null, $noteBody = null, $meta = array())
{
$objFieldSet = new Fieldset($header, $noteHeader, $noteBody, $meta);
$this->__elements->addObject($objFieldSet);
return $objFieldSet;
} | Add a fieldset to the form field collection
Example:
```php
$objForm->addFieldset("Header for fieldset", "Note", "Cool fields contained by fieldset.");
```
@param string $header The header for this fieldset
@param string $noteHeader An optional header for the 'note' block on the side of this fieldset
@param string $noteBody The optional body for the 'note block on the side of this fieldset
@param array $meta The meta array
@return \ValidFormBuilder\Fieldset | entailment |
public function addHiddenField($name, $type, $meta = array(), $blnJustRender = false)
{
$objField = new Hidden($name, $type, $meta);
if (! $blnJustRender) {
// *** Fieldset already defined?
$objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
if ($this->__elements->count() == 0 || ! is_object($objFieldset)) {
$objFieldset = $this->addFieldset();
}
$objField->setMeta("parent", $objFieldset, true);
// *** Add field to the fieldset.
$objFieldset->addField($objField);
}
return $objField;
} | Add a hidden input field to the form collection.
Hidden fields can be used for example to inject custom values in your post data and still have
them validated using ValidForm Builder.
@param string $name The hidden field's `name` attribute
@param string $type Define a validation type using one of the `ValidForm::VFORM_` constants. This does **not**
influence the fact that you're creating a hidden field. This is only used for validation of the hidden field's
content.
@param array $meta Optional meta array
@param boolean $blnJustRender If true, only create a {@link \ValidFormBuilder\Hidden} instance and return it.
When false, this {@link \ValidFormBuilder\Hidden} instance is added to the internal `elements` collection
and will be parsed when `toHtml()` is called.
@return \ValidFormBuilder\Hidden | entailment |
public static function renderField($name, $label, $type, $validationRules, $errorHandlers, $meta)
{
$objField = null;
switch ($type) {
case static::VFORM_STRING:
case static::VFORM_WORD:
case static::VFORM_EMAIL:
case static::VFORM_URL:
case static::VFORM_SIMPLEURL:
case static::VFORM_CUSTOM:
case static::VFORM_CURRENCY:
case static::VFORM_DATE:
case static::VFORM_NUMERIC:
case static::VFORM_INTEGER:
$objField = new Text($name, $type, $label, $validationRules, $errorHandlers, $meta);
break;
case static::VFORM_PASSWORD:
$objField = new Password($name, $type, $label, $validationRules, $errorHandlers, $meta);
break;
case static::VFORM_HTML:
case static::VFORM_CUSTOM_TEXT:
case static::VFORM_TEXT:
$objField = new Textarea($name, $type, $label, $validationRules, $errorHandlers, $meta);
break;
case static::VFORM_FILE:
$objField = new File($name, $type, $label, $validationRules, $errorHandlers, $meta);
break;
case static::VFORM_BOOLEAN:
$objField = new Checkbox($name, $type, $label, $validationRules, $errorHandlers, $meta);
break;
case static::VFORM_RADIO_LIST:
case static::VFORM_CHECK_LIST:
$objField = new Group($name, $type, $label, $validationRules, $errorHandlers, $meta);
break;
case static::VFORM_SELECT_LIST:
$objField = new Select($name, $type, $label, $validationRules, $errorHandlers, $meta);
break;
case static::VFORM_HIDDEN:
$objField = new Hidden($name, $type, $meta);
break;
default:
$objField = new Element($name, $type, $label, $validationRules, $errorHandlers, $meta);
break;
}
return $objField;
} | Use this utility method to only render \ValidFormBuilder\Element instances of the defined types.
Elements rendered with this method aren't added to the internal elements collection.
@param string $name The element's name
@param string $label The element's label
@param integer $type The element's validation type
@param array $validationRules Optional.Custom validation rules array
@param array $errorHandlers Custom error handling array
@param array $meta Optional. Meta data array
@return \ValidFormBuilder\Element Returns null when no valid type is defined | entailment |
public function addField(
$name,
$label,
$type,
$validationRules = array(),
$errorHandlers = array(),
$meta = array(),
$blnJustRender = false
) {
$objField = static::renderField($name, $label, $type, $validationRules, $errorHandlers, $meta);
$objField->setRequiredStyle($this->__requiredstyle);
if (! $blnJustRender) {
// *** Fieldset already defined?
$objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
if ($this->__elements->count() == 0 || ! is_object($objFieldset)) {
$objFieldset = $this->addFieldset();
}
$objField->setMeta("parent", $objFieldset, true);
// *** Add field to the fieldset.
$objFieldset->addField($objField);
}
return $objField;
} | Add a new element to the internal elements collection
*Example; add a text field*:
```php
$objForm->addField(
"first-name",
"First name",
ValidForm::VFORM_STRING,
array(
// Make this field required
"required" => true
),
array(
// Show this error to indicate this is an required field if no value is submitted
"required" => "This field is required"
)
);
```
@api
@param string $name The element's name
@param string $label The element's label
@param integer $type The element's validation type
@param array $validationRules Optional.Custom validation rules array
@param array $errorHandlers Custom error handling array
@param array $meta Optional. Meta data array
@param boolean $blnJustRender When true, the element is not added to the internal elements collection.
`addField()` with `$blnJustRender` set to true is exactly the same as calling `ValidForm::renderField()`
@return \ValidFormBuilder\Element Returns null when no valid type is defined | entailment |
public function addParagraph($strBody, $strHeader = "", $meta = array())
{
$objParagraph = new Paragraph($strHeader, $strBody, $meta);
// *** Fieldset already defined?
$objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
if ($this->__elements->count() == 0 || ! is_object($objFieldset)) {
$objFieldset = $this->addFieldset();
}
$objParagraph->setMeta("parent", $objFieldset, true);
// *** Add field to the fieldset.
$objFieldset->addField($objParagraph);
return $objParagraph;
} | Adds a \ValidFormBuilder\Paragraph object to the internal elements collection.
This renders a paragraph inside the form. Formfields can be added before and after the paragraph.
**Example:**
```php
$objForm->addField("name", "Your Name", ValidForm::VFORM_STRING);
$objForm->addParagraph("Next, you should enter your last name.", "Enter your name!");
$objForm->addField("last-name", "Last Name", ValidForm::VFORM_STRING);
```
@param string $strBody Paragraph body
@param string $strHeader Optional header above the paragraph
@param array $meta Custom meta array
@return \ValidFormBuilder\Paragraph | entailment |
public function addButton($strLabel, $arrMeta = array())
{
$objButton = new Button($strLabel, $arrMeta);
// *** Fieldset already defined?
$objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
if ($this->__elements->count() == 0 || ! is_object($objFieldset)) {
$objFieldset = $this->addFieldset();
}
$objButton->setMeta("parent", $objFieldset, true);
// *** Add field to the fieldset.
$objFieldset->addField($objButton);
return $objButton;
} | Adds a <button> element to the internal fields collection.
For an example; see {@link \ValidFormBuilder\Button}
@param string $strLabel The button's label
@param array $arrMeta The meta array
@return \ValidFormBuilder\Button | entailment |
public function addArea($label = null, $active = false, $name = null, $checked = false, $meta = array())
{
$objArea = new Area($label, $active, $name, $checked, $meta);
$objArea->setRequiredStyle($this->__requiredstyle);
// *** Fieldset already defined?
$objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
if ($this->__elements->count() == 0 || ! is_object($objFieldset)) {
// No fieldset found in the elements collection, add a fieldset.
$objFieldset = $this->addFieldset();
}
$objArea->setMeta("parent", $objFieldset, true);
// *** Add field to the fieldset.
$objFieldset->addField($objArea);
return $objArea;
} | Add an area to the internal elements collection.
See {@link \ValidFormBuilder\Area} for examples
@param string $label The title of this area
@param bool $active If `true`, the title has a checkbox which can enable or disable all child elements
@param string $name The ID of this area
@param bool $checked Use in combination with `$active`; if `true`, the checkbox will be checked by default
@param array $meta The meta array
@return \ValidFormBuilder\Area | entailment |
public function addMultiField($label = null, $meta = array())
{
$strName = (isset($meta["name"])) ? $meta["name"] : null;
$objField = new MultiField($label, $meta, $strName);
$objField->setRequiredStyle($this->__requiredstyle);
// *** Fieldset already defined?
$objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
if ($this->__elements->count() == 0 || ! is_object($objFieldset)) {
$objFieldset = $this->addFieldset();
}
$objField->setMeta("parent", $objFieldset, true);
// *** Add field to the fieldset.
$objFieldset->addField($objField);
return $objField;
} | Create a Multifield element
Multifield elements allow you to combine multiple fields horizontally with one label.
For example, create a first name + last name field with label "Full name"
```php
$objMulti = $objForm->addMultifield("Full name");
// Note: when using addField on a multifield, we don't set a label!
$objMulti->addField(
"first-name",
ValidForm::VFORM_STRING,
array(),
array(),
// Keep it short, this is just a first name field
array("style" => "width: 50px")
);
$objMulti->addField("last-name", ValidForm::VFORM_STRING);
```
You can also combine select elements to create a date picker:
```php
$objMulti = $objForm->addMultiField("Birthdate");
$objMulti->addField(
"year",
ValidForm::VFORM_SELECT_LIST,
array(),
array(),
array(
"start" => 1920,
"end" => 2014,
// 'fieldstyle' gets applied on the <select>
// regular 'style' applies on the wrapping <div>
"fieldstyle" => "width: 75px"
)
);
$objMulti->addField(
"month",
ValidForm::VFORM_SELECT_LIST,
array(),
array(),
array(
"start" => 01,
"end" => 12,
"fieldstyle" => "width: 75px"
)
);
$objMulti->addField(
"day",
ValidForm::VFORM_SELECT_LIST,
array(),
array(),
array(
"start" => 1,
"end" => 31,
"fieldstyle" => "width: 75px"
)
);
```
@param string $label
@param array $meta The meta array
@return \ValidFormBuilder\MultiField | entailment |
public function toHtml($blnClientSide = true, $blnForceSubmitted = null, $strCustomJs = "")
{
$strOutput = "";
if ($blnClientSide) {
$strOutput .= $this->__toJS($strCustomJs);
}
$strClass = "validform";
if (is_array($this->__meta)) {
if (isset($this->__meta["class"])) {
$strClass .= " " . $this->__meta["class"];
}
}
$blnForceSubmitted = (is_null($blnForceSubmitted)) ? $this->isSubmitted() : $blnForceSubmitted;
$strAutoComplete = (!$this->autocomplete) ? "autocomplete=\"off\" " : "";
$strOutput .= "<form " .
"id=\"{$this->__name}\" " .
"method=\"post\" " .
"enctype=\"multipart/form-data\" " .
"action=\"{$this->__action}\" {$strAutoComplete}" .
"class=\"{$strClass}\"{$this->__metaToData()}>\n";
// *** Main error.
if ($blnForceSubmitted && !empty($this->__mainalert)) {
$strOutput .= "<div class=\"vf__main_error\"><p>{$this->__mainalert}</p></div>\n";
}
if (!empty($this->__description)) {
$strOutput .= "<div class=\"vf__description\"><p>{$this->__description}</p></div>\n";
}
$blnNavigation = false;
$strOutput .= $this->fieldsToHtml($blnForceSubmitted, $blnNavigation);
if (!$blnNavigation) {
$strOutput .= "<div class=\"vf__navigation\">\n";
$strOutput .= "<input type=\"submit\" value=\"{$this->__submitlabel}\" class=\"vf__button\" />\n";
$strOutput .= "</div>\n";
}
$strOutput .= "<input type=\"hidden\" name=\"vf__dispatch\" value=\"{$this->__name}\" />\n";
if ($this->__usecsrfprotection) {
$strOutput .= "<input type=\"hidden\" name=\"" . CSRF::TOKEN_NAME
. "\" value=\"" . CSRF::getToken() . "\" />\n";
}
$strOutput .= "</form>";
return $strOutput;
} | Generate HTML output - build form
@param bool $blnClientSide Render javascript code or not, defaults to true
@param bool $blnForceSubmitted This forces the form rendering as if the fields are submitted
@param string $strCustomJs Inject custom javascript to be executed while
initializing ValidForm Builder client-side.
@return string Generated HTML output | entailment |
public function fieldsToHtml($blnForceSubmitted = false, &$blnNavigation = false)
{
$strReturn = "";
if (is_array($this->__defaults) && count($this->__defaults) > 0) {
$objFields = $this->getCachedFields();
foreach ($objFields as $objField) {
$strName = $objField->getName(true); // true strips the [] off a checkbox's name
if (array_key_exists($strName, $this->__defaults)) {
$varValue = $this->__defaults[$strName];
$blnDynamic = $objField->isDynamic();
if (! $blnDynamic) {
/* @var $objParent Base */
$objParent = $objField->getMeta("parent", null);
if (is_object($objParent)) {
$blnDynamic = $objParent->isDynamic();
}
}
if (is_array($varValue)
&& !array_key_exists($strName . "_dynamic", $this->__defaults)
&& $blnDynamic
) {
$intDynamicCount = 0;
if (count($varValue) > 0) {
$intDynamicCount = count($varValue) - 1; // convert to zero-based
}
$this->__defaults[$strName . "_dynamic"] = $intDynamicCount;
}
$objField->setDefault($varValue);
}
}
}
$blnDisplayErrors = ($this->isSubmitted()) ? true : $this->getDisplayErrors();
foreach ($this->__elements as $element) {
$strReturn .= $element->toHtml($this->isSubmitted($blnForceSubmitted), false, true, $blnDisplayErrors);
if (get_class($element) == "ValidFormBuilder\\Navigation") {
$blnNavigation = true;
}
}
return $strReturn;
} | This method generates HTML output for the current internal elements collection.
This method is mostly used internally in the library and it's therefore not recommended to use this except
for these rare occasions when you only want the rendered fields an not all the meta surrounding the fields
like the form tag, description element and form error message.
@param bool $blnForceSubmitted This forces the form rendering as if the fields are submitted
@param bool $blnNavigation This is a reference returning true if the form contains a navigation element
@return string Generated HTML output | entailment |
public function elementsToJs($blnRawJs = false)
{
$strReturn = "";
$strJs = "";
// *** Loop through all form elements and get their javascript code.
foreach ($this->__elements as $element) {
$strJs .= $element->toJS();
}
// Indent javascript
$strJs = str_replace("\n", "\n\t", $strJs);
if (! $blnRawJs) {
$strReturn .= "<script type=\"text/javascript\">\n";
$strReturn .= "// <![CDATA[\n";
}
$strReturn .= "\tvar objForm = $(\"#{$this->__name}\").data(\"vf__formElement\");\n\t";
$strReturn .= $strJs;
$strReturn .= "objForm.initialize();\n";
if (! $blnRawJs) {
$strReturn .= "// ]]>\n";
$strReturn .= "</script>\n";
}
return $strReturn;
} | Generate the Javascript output only for the fields and conditions.
This is particulary useful when using ValidForm Builder in combination with AJAX form handling. You can inject
new fields and field logic into an existing ValidForm and all validation will be handled by that "parent" form.
@param boolean $blnRawJs Return javascript without the surrounding <script> tags.
@return string | entailment |
public function serialize($blnSubmittedValues = true)
{
// Validate & cache all values
$this->valuesAsHtml($blnSubmittedValues); // Especially dynamic counters need this!
return base64_encode(gzcompress(serialize($this)));
} | Serialize, compress and encode the entire form including it's values
@param boolean $blnSubmittedValues
Whether or not to include submitted values or only serialize default values.
@return String Base64 encoded, gzcompressed, serialized form. | entailment |
public function isSubmitted($blnForce = false)
{
if (ValidForm::get("vf__dispatch") == $this->__name || $blnForce) {
if ($this->__usecsrfprotection && !$blnForce) {
return CSRF::validate($_POST);
} else {
return true;
}
} else {
return false;
}
} | Check if the form is submitted by validating the value of the hidden
vf__dispatch field.
@param boolean $blnForce Fake isSubmitted to true to force field values.
@return boolean | entailment |
public function getCachedFields()
{
$objReturn = $this->__cachedfields;
if (is_null($objReturn)) {
$objReturn = $this->getFields();
}
return $objReturn;
} | Fetch a cached flat collection of form fields instead of making
an expensive getFields() call and looping through all elements
@return Collection | entailment |
public function getFields()
{
$objFields = new Collection();
foreach ($this->__elements as $objFieldset) {
if ($objFieldset->hasFields()) {
/* @var $objField Base */
foreach ($objFieldset->getFields() as $objField) {
if (is_object($objField)) {
if ($objField->hasFields()) {
if (get_class($objField) == "ValidFormBuilder\\Area" && $objField->isActive()) {
$objFields->addObject($objField);
}
foreach ($objField->getFields() as $objSubField) {
if (is_object($objSubField)) {
if ($objSubField->hasFields()) {
if (get_class($objSubField) == "ValidFormBuilder\\Area"
&& $objSubField->isActive()
) {
$objFields->addObject($objSubField);
}
foreach ($objSubField->getFields() as $objSubSubField) {
if (is_object($objSubSubField)) {
$objFields->addObject($objSubSubField);
}
}
} else {
$objFields->addObject($objSubField);
}
}
}
} else {
$objFields->addObject($objField);
}
}
}
} else {
$objFields->addObject($objFieldset);
}
}
$this->__cachedfields = $objFields;
return $objFields;
} | Get a flat Collection of all internal elements.
This loops through all elements and adds each element and their children to a new Collection which will be
returned. This results in a flat Collection filled with ValidForm Builder elements.
@return \ValidFormBuilder\Collection | entailment |
public function getValidField($id)
{
$objReturn = null;
$objFields = $this->getFields();
foreach ($objFields as $objField) {
if ($objField->getId() == $id) {
$objReturn = $objField;
break;
}
}
if (is_null($objReturn)) {
foreach ($objFields as $objField) {
if ($objField->getName() == $id) {
$objReturn = $objField;
break;
}
}
}
return $objReturn;
} | Get a valid field object.
This is about the most important method of ValidForm Builder. Use this to get a valid field after validation
to fetch it's validated value.
Example:
```php
$objForm = new ValidForm('example');
$objForm->addField('test', 'Test field', ValidForm::VFORM_STRING);
if ($objForm->isSubmitted() && $objForm->isValid()) {
$strTest = $objForm->getValidField("test")->getValue();
// $strTest now contains the validated value of the 'test' field which is safe for database storage etc.
$strOutput = "Test value is: " . $strTest;
} else {
$strOutput = $objForm->toHtml();
}
```
@param string $id
@return Element|null | entailment |
public function getInvalidFields()
{
$objFields = $this->getFields();
$arrReturn = array();
foreach ($objFields as $objField) {
$arrTemp = array();
if (! $objField->isValid()) {
$arrTemp[$objField->getName()] = $objField->getValidator()->getError();
array_push($arrReturn, $arrTemp);
}
}
return $arrReturn;
} | Get an associative array of invalid field names (the array's keys) and the error message (the values)
This method is very useful when using ValidForm Builder with AJAX empowered forms.
Example:
```php
//*** The basic form set-up
$objForm = new ValidForm('ajaxForm');
$objForm->addField(
'firstName',
'First name',
ValidForm::VFORM_STRING,
array(
'required' => true
),
array(
'required' => 'This field is required'
)
);
$objForm->addField(
'lastName',
'Last name',
ValidForm::VFORM_STRING
);
$objForm->addField(
'emailAddress',
'E-mail address',
ValidForm::VFORM_EMAIL,
array(),
array(
'type' => 'Invalid e-mail address'
)
);
//*** Form handling
if ($objForm->isSubmitted() && $objForm->isValid()) {
// Form is submitted and valid, do stuff with the validated values
} elseif ($objForm->isSubmitted()) {
// Form is submitted but not valid, return the invalid fields array as a response:
$strOutput = json_encode(
$objForm->getInvalidFields()
);
} else {
// Form is not even submitted, show regular parsed form
$strOutput = $objForm->toHtml();
}
```
Assuming we've posted the following values (and managed to bypass client-side validation):
- firstName: ''
- lastName: 'van Baalen'
- emailAddress: 'Robin Hood'
The following would be a response from `getInvalidFields()`:
```php
array(
'firstName' => 'This field is required',
'emailAddress' => 'Invalid e-mail address'
)
```
@return array | entailment |
public function valuesAsHtml($hideEmpty = false, $collection = null)
{
$strTable = "\t<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"validform\">\n";
$strTableOutput = "";
$collection = (!is_null($collection)) ? $collection : $this->__elements;
foreach ($collection as $objFieldset) {
$strSet = "";
$strTableOutput .= $this->fieldsetAsHtml($objFieldset, $strSet, $hideEmpty);
}
if (! empty($strTableOutput)) {
return $strTable . $strTableOutput . "</table>";
} else {
if (! empty($this->__novaluesmessage)) {
return $strTable . "<tr><td colspan=\"3\">{$this->__novaluesmessage}</td></tr></table>";
} else {
return "";
}
}
} | A utility method to parse an overview of the submitted values.
This generates a table with `label: value` pairs. The output of this function is mostly used in for example
e-mail bodies. When the contact form created with ValidForm Builder is submitted, you only have to e-mail
the results of `valuesAsHtml()`
@param boolean $hideEmpty Set to true to hide empty field values from the overview. Defaults to false.
@param string $collection Optional - advanced usage only; a custom Collection of elements to parse
@return string Generated `table` with `label: value` pairs | entailment |
public function fieldsetAsHtml($objFieldset, &$strSet, $hideEmpty = false)
{
$strTableOutput = "";
// If this fieldset was rendered invisible due to conditions,
// don't show it on the valuesAsHtml overview either.
if (!$this->elementShouldDisplay($objFieldset)) {
return $strTableOutput;
}
foreach ($objFieldset->getFields() as $objField) {
if (is_object($objField) && get_class($objField) !== "ValidFormBuilder\\Hidden") {
//*** Get the string value. If it's an array, implode with ','
$strValue = $objField->getValue();
if (is_array($strValue)) {
$strValue = implode(", ", $strValue);
}
if ((! empty($strValue) && $hideEmpty) || (! $hideEmpty && ! is_null($strValue))) {
if ($objField->hasFields()) {
switch (get_class($objField)) {
case "ValidFormBuilder\\MultiField":
$strSet .= $this->multiFieldAsHtml($objField, $hideEmpty);
break;
default:
$strSet .= $this->areaAsHtml($objField, $hideEmpty);
}
} else {
$strSet .= $this->fieldAsHtml($objField, $hideEmpty);
}
}
if ($objField->isDynamic()) {
$intDynamicCount = $objField->getDynamicCount();
if ($intDynamicCount > 0) {
for ($intCount = 1; $intCount <= $intDynamicCount; $intCount ++) {
switch (get_class($objField)) {
case "ValidFormBuilder\\MultiField":
$strSet .= $this->multiFieldAsHtml($objField, $hideEmpty, $intCount);
break;
case "ValidFormBuilder\\Area":
$strSet .= $this->areaAsHtml($objField, $hideEmpty, $intCount);
break;
default:
$strSet .= $this->fieldAsHtml($objField, $hideEmpty, $intCount);
}
}
}
}
}
}
$strHeader = $objFieldset->getHeader();
if (! empty($strHeader) && ! empty($strSet)) {
$strTableOutput .= "<tr>";
$strTableOutput .= "<td colspan=\"3\"> </td>\n";
$strTableOutput .= "</tr>";
$strTableOutput .= "<tr>";
$strTableOutput .= "<td colspan=\"3\"><b>{$strHeader}</b></td>\n";
$strTableOutput .= "</tr>";
}
if (! empty($strSet)) {
$strTableOutput .= $strSet;
}
return $strTableOutput;
} | Generates HTML output for all fieldsets and their children elements.
This method is hardly used in the public API. The only reason why this is a public method is to enable
customization through class extension.
@param Fieldset $objFieldset The Fieldset object to parse
@param string $strSet Previously generated HTML
@param boolean $hideEmpty Set to true to hide empty field values from the overview. Defaults to false.
@return string Generated HTML | entailment |
protected function areaAsHtml($objField, $hideEmpty = false, $intDynamicCount = 0)
{
$strReturn = "";
$strSet = "";
// If this area was rendered invisible due to conditions,
// don't show it on the valuesAsHtml overview either.
$blnShouldDisplay = $this->elementShouldDisplay($objField);
if ($objField->hasContent($intDynamicCount) && $blnShouldDisplay) {
foreach ($objField->getFields() as $objSubField) {
if (get_class($objSubField) !== "ValidFormBuilder\\Paragraph") {
switch (get_class($objSubField)) {
case "ValidFormBuilder\\MultiField":
$strSet .= $this->multiFieldAsHtml($objSubField, $hideEmpty, $intDynamicCount);
break;
default:
$strSet .= $this->fieldAsHtml($objSubField, $hideEmpty, $intDynamicCount);
// Support nested dynamic fields.
if ($objSubField->isDynamic()) {
$intDynamicCount = $objSubField->getDynamicCount();
for ($intCount = 1; $intCount <= $intDynamicCount; $intCount ++) {
$strSet .= $this->fieldAsHtml($objSubField, $hideEmpty, $intCount);
}
}
}
}
}
}
$strLabel = $objField->getShortLabel();
if (!empty($strSet)) {
if (!empty($strLabel)) {
$strReturn = "<tr>";
$strReturn .= "<td colspan=\"3\" style=\"white-space:nowrap\" class=\"vf__area_header\">";
$strReturn .= "<h3>{$strLabel}</h3>";
$strReturn .= "</td>\n";
$strReturn .= "</tr>";
}
$strReturn .= $strSet;
} else {
if (!empty($this->__novaluesmessage) && $objField->isActive()) {
$strReturn = "<tr>";
$strReturn .= "<td colspan=\"3\" style=\"white-space:nowrap\" class=\"vf__area_header\">";
$strReturn .= "<h3>{$strLabel}</h3>";
$strReturn .= "</td>\n";
$strReturn .= "</tr>";
return $strReturn . "<tr><td colspan=\"3\">{$this->__novaluesmessage}</td></tr>";
} else {
return "";
}
}
return $strReturn;
} | Generates HTML output for the given area object and its child elements
@param Area $objField The Area object to parse
@param boolean $hideEmpty Set to true to hide empty field values from the overview. Defaults to false.
@param integer $intDynamicCount The dynamic counter for the current area being parsed
@return string Generated HTML | entailment |
protected function multiFieldAsHtml($objField, $hideEmpty = false, $intDynamicCount = 0)
{
$strReturn = "";
// If this multi field was rendered invisible due to conditions,
// don't show it on the valuesAsHtml overview either.
if (!$this->elementShouldDisplay($objField)) {
return $strReturn;
}
if ($objField->hasContent($intDynamicCount)) {
if ($objField->hasFields()) {
$strValue = "";
$objSubFields = $objField->getFields();
$intCount = 0;
foreach ($objSubFields as $objSubField) {
$intCount ++;
if (get_class($objSubField) == "ValidFormBuilder\\Hidden" && $objSubField->isDynamicCounter()) {
continue;
}
$varValue = $objSubField->getValue($intDynamicCount);
$strValue .= (is_array($varValue)) ? implode(", ", $varValue) : $varValue;
$strValue .= ($objSubFields->count() > $intCount) ? " " : "";
}
$strValue = trim($strValue);
$strLabel = $objField->getShortLabel();
if ((! empty($strValue) && $hideEmpty) || (! $hideEmpty && ! empty($strValue))) {
$strValue = htmlspecialchars($strValue, ENT_QUOTES);
$strValue = nl2br($strValue);
$strReturn .= "<tr class=\"vf__field_value\">";
$strReturn .= "<td valign=\"top\"";
$strReturn .= " style=\"white-space:nowrap; padding-right: 20px\"";
$strReturn .= " class=\"vf__field\">";
$strReturn .= $strLabel;
$strReturn .= "</td>";
$strReturn .= "<td valign=\"top\" class=\"vf__value\">";
$strReturn .= "<strong>" . $strValue . "</strong>";
$strReturn .= "</td>\n";
$strReturn .= "</tr>";
}
}
}
return $strReturn;
} | Generates HTML output for the given MultiField object and its child elements
@param MultiField $objField The Area object to parse
@param boolean $hideEmpty Set to true to hide empty field values from the overview. Defaults to false.
@param integer $intDynamicCount The dynamic counter for the current MultiField being parsed
@return string Generated HTML | entailment |
protected function fieldAsHtml($objField, $hideEmpty = false, $intDynamicCount = 0)
{
$strReturn = "";
$strLabel = $objField->getShortLabel(); // Passing 'true' gets the short label if available.
$varValue = ($intDynamicCount > 0) ? $objField->getValue($intDynamicCount) : $objField->getValue();
$strValue = (is_array($varValue)) ? implode(", ", $varValue) : $varValue;
// If this field was rendered invisible due to conditions,
// don't show it on the valuesAsHtml overview either.
if (!$this->elementShouldDisplay($objField)) {
return $strReturn;
}
if ((! empty($strValue) && $hideEmpty) || (! $hideEmpty && ! is_null($strValue))) {
if ((get_class($objField) == "ValidFormBuilder\\Hidden") && $objField->isDynamicCounter()) {
return $strReturn;
} else {
switch ($objField->getType()) {
case static::VFORM_BOOLEAN:
$strValue = ($strValue == 1) ? "yes" : "no";
break;
}
if (empty($strLabel) && empty($strValue)) {
// *** Skip the field.
} else {
$strValue = htmlspecialchars($strValue, ENT_QUOTES);
$strValue = nl2br($strValue);
$strReturn .= "<tr class=\"vf__field_value\">";
$strReturn .= "<td valign=\"top\" style=\"padding-right: 20px\" class=\"vf__field\">";
$strReturn .= $strLabel;
$strReturn .= "</td>";
$strReturn .= "<td valign=\"top\" class=\"vf__value\">";
$strReturn .= "<strong>" . $strValue . "</strong>";
$strReturn .= "</td>\n";
$strReturn .= "</tr>";
}
}
}
return $strReturn;
} | Generates HTML output for the given field object and its child elements
@param Element $objField The Element class-based object to parse
@param boolean $hideEmpty Set to true to hide empty field values from the overview. Defaults to false.
@param integer $intDynamicCount The dynamic counter for the current Element being parsed
@return string Generated HTML | entailment |
public function generateId($intLength = 8)
{
$strChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$strReturn = '';
srand((double) microtime() * 1000000);
for ($i = 1; $i <= $intLength; $i ++) {
$intNum = rand() % (strlen($strChars) - 1);
$strTmp = substr($strChars, $intNum, 1);
$strReturn .= $strTmp;
}
return $strReturn;
} | Generate a unique ID
@param integer $intLength ID length
@return string Generated ID | entailment |
public static function get($param, $replaceEmpty = "")
{
$strReturn = (isset($_REQUEST[$param])) ? $_REQUEST[$param] : "";
if (empty($strReturn) && !is_numeric($strReturn) && $strReturn !== 0) {
//*** Try PUT or DELETE.
$strReturn = static::getHttpBodyValue($param, "");
if (empty($strReturn) && !is_numeric($strReturn) && $strReturn !== 0) {
//*** Return replace value.
$strReturn = $replaceEmpty;
}
}
return $strReturn;
} | Read parameters from the `$_REQUEST` array and body string with an optional fallback value
@param string $param The parameter to read
@param string $replaceEmpty Optional replace value when parameter is not available or empty
@return string|array | entailment |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.