本文整理汇总了PHP中fajr\libfajr\base\Preconditions::checkIsString方法的典型用法代码示例。如果您正苦于以下问题:PHP Preconditions::checkIsString方法的具体用法?PHP Preconditions::checkIsString怎么用?PHP Preconditions::checkIsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fajr\libfajr\base\Preconditions
的用法示例。
在下文中一共展示了Preconditions::checkIsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invokeAction
/**
* Invoke an action given its name
*
* This function requests information necessary to operate on
* VSES017 AIS application
*
* @param Trace $trace trace object
* @param string $action action name
* @param Context $context fajr context
*/
public function invokeAction(Trace $trace, $action, Context $context)
{
$request = $context->getRequest();
$response = $context->getResponse();
Preconditions::checkIsString($action);
$this->screenFactory = new VSES017\VSES017_factory($context->getAisConnection());
$this->adminStudia = $this->screenFactory->newAdministraciaStudiaScreen($trace);
$this->studium = $request->getParameter('studium', '0');
$this->zoznamStudii = $this->adminStudia->getZoznamStudii($trace->addChild("Get Zoznam Studii:"));
$this->zapisneListy = $this->adminStudia->getZapisneListy($trace->addChild('getZapisneListy'), $this->studium);
$this->zapisnyList = $request->getParameter('list');
if (empty($this->zapisnyList)) {
$tmp = $this->zapisneListy->getData();
$lastList = end($tmp);
$this->zapisnyList = $lastList['index'];
}
$this->terminyHodnoteniaScreen = $this->screenFactory->newTerminyHodnoteniaScreen($trace, $this->adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList), $this->adminStudia->getStudiumIdFromZapisnyListIndex($trace, $this->zapisnyList));
// FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne
// objekty, ktore v konstruktore robia requesty
$this->hodnoteniaScreen = $this->screenFactory->newHodnoteniaPriemeryScreen($trace, $this->adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList));
$response->set('zoznamStudii', $this->zoznamStudii);
$response->set('studium', $this->studium);
$response->set('zapisneListy', $this->zapisneListy);
$response->set('zapisnyList', $this->zapisnyList);
parent::invokeAction($trace, $action, $context);
}
示例2: addChild
/**
* Create a new ArrayTrace at the insertion point
* @param string $header text to use as header
* @return ArrayTrace child trace object
*/
public function addChild($header = "")
{
Preconditions::checkIsString($header, 'header');
$child = new ArrayTrace($this->timer, $header);
$this->children[] = array('info' => $this->getInfoArray(), 'type' => 'trace', 'trace' => $child);
return $child;
}
示例3: __construct
/**
* @param string $proxyDir path to directory containing cosign proxy files
*/
public function __construct($proxyDir, $proxyCookieName)
{
Preconditions::checkIsString($proxyDir, 'proxyDir');
Preconditions::checkIsString($proxyDir, 'proxyCookieName');
$this->proxyDir = $proxyDir;
$this->proxyCookieName = $proxyCookieName;
}
示例4: __construct
public function __construct(array $options, $cookieFile)
{
Preconditions::checkIsString($cookieFile, '$cookieFile should be string');
$this->options = $options;
$this->cookieFile = $cookieFile;
$this->_curlInit();
}
示例5: invokeAction
/**
* Invoke an action given its name
*
* This function checks if public non-abstract non-static runAction method
* exists in this object and calls it in such a case with request and response
* parameters
*
* @param Trace $trace trace object
* @param string $action action name
* @param Context $context fajr context
*/
public function invokeAction(Trace $trace, $action, Context $context)
{
Preconditions::checkIsString($action);
Preconditions::checkMatchesPattern('@^[A-Z][a-zA-Z]*$@', $action, '$action must start with capital letter and ' . 'contain only letters.');
$methodName = 'run' . $action;
if (!method_exists($this, $methodName)) {
throw new Exception('Action method ' . $methodName . ' does not exist');
}
$method = new ReflectionMethod($this, $methodName);
if (!$method->isPublic()) {
throw new Exception('Action method ' . $methodName . ' is not public');
}
if ($method->isAbstract()) {
throw new Exception('Action method ' . $methodName . ' is abstract');
}
if ($method->isStatic()) {
throw new Exception('Action method ' . $methodName . ' is static');
}
if ($method->isConstructor()) {
throw new Exception('Action method ' . $methodName . ' is constructor');
}
if ($method->isDestructor()) {
throw new Exception('Action method ' . $methodName . ' is destructor');
}
$method->invoke($this, $trace, $context);
}
示例6: invokeAction
/**
* Invoke an action given its name
*
* This function requests information necessary to operate on
* VSES017 AIS application
*
* @param Trace $trace trace object
* @param string $action action name
* @param Context $context fajr context
*/
public function invokeAction(Trace $trace, $action, Context $context)
{
Preconditions::checkIsString($action);
$request = $context->getRequest();
$response = $context->getResponse();
$session = $context->getSessionStorage();
// check access to application
if (!in_array(AIS2ApplicationEnum::ADMINISTRACIA_STUDIA, $session->read('ais/aisApps'))) {
$response->setTemplate('studium/notAvailable');
return;
}
$screenFactory = $this->factory;
$adminStudia = $screenFactory->newAdministraciaStudiaScreen($trace);
$this->studium = $request->getParameter('studium', '0');
$this->zoznamStudii = $adminStudia->getZoznamStudii($trace->addChild("Get Zoznam Studii:"));
$this->zapisneListy = $adminStudia->getZapisneListy($trace->addChild('getZapisneListy'), $this->studium);
FajrUtils::warnWrongTableStructure($response, 'zoznam studii', regression\ZoznamStudiiRegression::get(), $this->zoznamStudii->getTableDefinition());
FajrUtils::warnWrongTableStructure($response, 'zoznam zapisnych listov', regression\ZoznamZapisnychListovRegression::get(), $this->zapisneListy->getTableDefinition());
$this->zapisnyList = $request->getParameter('list');
if ($this->zapisnyList === '') {
$tmp = $this->zapisneListy->getData();
$lastList = end($tmp);
$this->zapisnyList = $lastList['index'];
}
$this->terminyHodnoteniaScreen = $screenFactory->newTerminyHodnoteniaScreen($trace, $adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList), $adminStudia->getStudiumIdFromZapisnyListIndex($trace, $this->zapisnyList));
// FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne
// objekty, ktore v konstruktore robia requesty
$this->hodnoteniaScreen = $screenFactory->newHodnoteniaPriemeryScreen($trace, $adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList));
$response->set('zoznamStudii', $this->zoznamStudii);
$response->set('studium', $this->studium);
$response->set('zapisneListy', $this->zapisneListy);
$response->set('zapisnyList', $this->zapisnyList);
parent::invokeAction($trace, $action, $context);
}
示例7: __construct
/**
* @param string $proxyDir path to directory containing cosign proxy files
*/
public function __construct($proxyDir, $proxyCookieName)
{
Preconditions::checkIsString($proxyDir, '$proxyDir should be string.');
Preconditions::checkIsString($proxyCookieName, '$proxyCookieName should be string');
$this->proxyDir = $proxyDir;
$this->proxyCookieName = $proxyCookieName;
}
示例8: getSkinByName
/**
* @param string $name name of the skin to retrieve
*
* @returns SkinConfig
* @throws IllegalArgumentException
*/
public function getSkinByName($name)
{
Preconditions::checkIsString($name);
if (!in_array($name, array_keys($this->skins))) {
throw new IllegalArgumentException("You must specify a valid skin!");
}
return $this->skins[$name];
}
示例9: write
public function write($string)
{
Preconditions::checkIsString($string, '$string must be string');
$this->checkNotClosed();
if (@fwrite($this->handle, $string) === false) {
throw new Exception("Cannot write file");
}
}
示例10: parseUserNameFromMainPage
/**
* Parses user name from AIS2 start page
*
* @param string $html AIS2 html reply to be parsed
*
* @returns AIS2Version AIS2 version
* @throws ParseException on error
*/
public function parseUserNameFromMainPage($html)
{
Preconditions::checkIsString($html);
$data = StrUtil::matchAll(self::USERNAME_PATTERN, $html);
if ($data === false) {
throw new ParseException("Cannot parse username from response.");
}
return $data['username'];
}
示例11: parseVersionStringFromMainPage
/**
* Parses the AIS2 version from html page.
*
* @param string $html AIS2 html reply to be parsed
*
* @returns AIS2Version AIS2 version
* @throws ParseException on error
*/
public function parseVersionStringFromMainPage($html)
{
Preconditions::checkIsString($html);
$data = StrUtil::matchAll(self::VERSION_PATTERN, $html);
if ($data === false) {
throw new ParseException("Cannot parse AIS version from response.");
}
return new AIS2Version(2, $data['major'], $data['minor'], $data['patch']);
}
示例12: deserialize
/**
* Deserialize previously serialized value.
*
* @param string $data
*
* @returns mixed deserialized value
*/
public static function deserialize($data)
{
Preconditions::checkIsString($data);
$result = @unserialize($data);
if ($result == false || !array_key_exists('value', $result)) {
throw new InvalidArgumentException("Invalid data to deserialize.");
}
return $result['value'];
}
示例13: get
/**
* Get a value of a given key
* @param string $key
* @returns mixed value of a given key
* @throws InvalidArgumentException if the key does not exist
*/
public function get($key)
{
Preconditions::checkIsString($key);
// Note: isset() returns false if the item value is null
if (!array_key_exists($key, $this->config)) {
throw new InvalidArgumentException('Unknown configuration parameter: ' . $key);
}
return $this->config[$key];
}
示例14: invokeAction
/**
* Invoke an action given its name
*
* This function requests information necessary to operate on
* VSES017 AIS application
*
* @param Trace $trace trace object
* @param string $action action name
* @param Context $context fajr context
*/
public function invokeAction(Trace $trace, $action, Context $context)
{
Preconditions::checkIsString($action);
$request = $context->getRequest();
$response = $context->getResponse();
$session = $context->getSessionStorage();
Preconditions::checkNotNull($request);
Preconditions::checkNotNull($response);
Preconditions::checkNotNull($session);
// check access to application
$apps = $session->read('ais/aisApps');
if (!is_array($apps)) {
throw new Exception("Interná chyba - zoznam AIS aplikácii je nekorektný.");
}
if (!in_array(AIS2ApplicationEnum::ADMINISTRACIA_STUDIA, $apps)) {
$response->setTemplate('studium/notAvailable');
return;
}
$screenFactory = $this->factory;
$adminStudia = $screenFactory->newAdministraciaStudiaScreen($trace);
$this->administraciaStudiaScreen = $adminStudia;
$this->studium = $request->getParameter('studium', '0');
$this->zoznamStudii = $adminStudia->getZoznamStudii($trace->addChild("Get Zoznam Studii:"));
$this->zapisneListy = $adminStudia->getZapisneListy($trace->addChild('getZapisneListy'), $this->studium);
FajrUtils::warnWrongTableStructure($trace, $response, 'zoznam studii', regression\ZoznamStudiiRegression::get(), $this->zoznamStudii->getTableDefinition());
FajrUtils::warnWrongTableStructure($trace, $response, 'zoznam zapisnych listov', regression\ZoznamZapisnychListovRegression::get(), $this->zapisneListy->getTableDefinition());
$zapisneListyData = $this->zapisneListy->getData();
if (count($zapisneListyData) == 0) {
$this->zapisnyList = null;
$this->terminyHodnoteniaScreen = null;
$this->hodnoteniaScreen = null;
} else {
$this->zapisnyList = $request->getParameter('list');
if ($this->zapisnyList === '') {
$lastList = end($zapisneListyData);
$this->zapisnyList = $lastList['index'];
}
$this->terminyHodnoteniaScreen = $screenFactory->newTerminyHodnoteniaScreen($trace, $adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList, VSES017\AdministraciaStudiaScreen::ACTION_TERMINY_HODNOTENIA), $adminStudia->getStudiumIdFromZapisnyListIndex($trace, $this->zapisnyList, VSES017\AdministraciaStudiaScreen::ACTION_TERMINY_HODNOTENIA));
// FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne
// objekty, ktore v konstruktore robia requesty
$this->hodnoteniaScreen = $screenFactory->newHodnoteniaPriemeryScreen($trace, $adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList, VSES017\AdministraciaStudiaScreen::ACTION_HODNOTENIA_PRIEMERY));
}
$response->set('zoznamStudii', $this->zoznamStudii);
$response->set('studium', $this->studium);
$response->set('zapisneListy', $this->zapisneListy);
$response->set('zapisnyList', $this->zapisnyList);
if (array_key_exists($action, $this->actionInfo)) {
$info = $this->actionInfo[$action];
if ($info['requiresZapisnyList'] && $this->zapisnyList == null) {
$response->set('activeTab', $info['tabName']);
$response->setTemplate('studium/chybaZapisnyList');
return;
}
}
parent::invokeAction($trace, $action, $context);
}
示例15: remove
/**
* Removes data from this storage.
*
* @param string $key key to the data
*
* @returns mixed data associated with the key
*/
public function remove($key)
{
Preconditions::checkIsString($key);
$retval = null;
if (array_key_exists($key, $this->data)) {
$retval = $this->data[$key];
unset($this->data[$key]);
}
return $retval;
}