本文整理汇总了PHP中Checker类的典型用法代码示例。如果您正苦于以下问题:PHP Checker类的具体用法?PHP Checker怎么用?PHP Checker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Checker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: show
public static function show()
{
$messages = new Messages();
$reporter = new \Jelix\Installer\Reporter\Html($messages);
$check = new Checker($reporter, $messages);
$check->addDatabaseCheck(array('mysql', 'sqlite', 'pgsql'), false);
header("Content-type:text/html;charset=UTF-8");
?>
<!DOCTYPE html>
<html lang="<?php
echo $check->messages->getLang();
?>
">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
<title><?php
echo htmlspecialchars($check->messages->get('checker.title'));
?>
</title>
<link type="text/css" href="jelix/design/jelix.css" rel="stylesheet" />
</head><body >
<h1 class="apptitle"><?php
echo htmlspecialchars($check->messages->get('checker.title'));
?>
</h1>
<?php
$check->run();
?>
</body>
</html>
<?php
}
开发者ID:mdouchin,项目名称:jelix,代码行数:35,代码来源:CheckerPage.php
示例2: checkFile
/**
* @param string $filename
* @param Settings $settings
* @return Result[]
*/
public function checkFile($filename, Settings $settings = null)
{
if ($settings === null) {
$settings = new Settings();
}
$content = $this->loadFile($filename);
$checker = new Checker($settings);
$results = $checker->check($content);
$this->setFilePathToResults($results, $filename);
return $results;
}
开发者ID:agentsib,项目名称:PHP-Var-Dump-Check,代码行数:16,代码来源:Manager.php
示例3: testCheckingForCacheReturnsWritableState
public function testCheckingForCacheReturnsWritableState()
{
mkdir($root = '/tmp/' . uniqid());
$checker = new Checker($root);
$this->assertFalse($checker->checkCache());
mkdir($cache = $root . '/cache');
chmod($cache, 00);
$this->assertFalse($checker->checkCache());
chmod($cache, 0700);
$this->assertTrue($checker->checkCache());
rmdir($cache);
rmdir($root);
}
开发者ID:mathroc,项目名称:php-vfs,代码行数:13,代码来源:CheckerTest.php
示例4: __construct
/**
* Constructor.
*
* @param AppInfo $appInfo
* See {@link getAppInfo()}
* @param string $clientIdentifier
* See {@link getClientIdentifier()}
* @param null|string $userLocale
* See {@link getUserLocale()}
*/
function __construct($appInfo, $clientIdentifier, $userLocale = null)
{
AppInfo::checkArg("appInfo", $appInfo);
Checker::argStringNonEmpty("clientIdentifier", $clientIdentifier);
Checker::argStringNonEmptyOrNull("userLocale", $userLocale);
$this->appInfo = $appInfo;
$this->clientIdentifier = $clientIdentifier;
$this->userLocale = $userLocale;
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:19,代码来源:WebAuthBase.php
示例5: getRandomBytes
/**
* Returns cryptographically strong secure random bytes (as a PHP string).
*
* @param int $numBytes
* The number of bytes of random data to return.
*
* @return string
*/
static function getRandomBytes($numBytes)
{
Checker::argIntPositive("numBytes", $numBytes);
// openssl_random_pseudo_bytes had some issues prior to PHP 5.3.4
if (function_exists('openssl_random_pseudo_bytes') && version_compare(PHP_VERSION, '5.3.4') >= 0) {
$s = openssl_random_pseudo_bytes($numBytes, $isCryptoStrong);
if ($isCryptoStrong) {
return $s;
}
}
if (function_exists('mcrypt_create_iv')) {
return mcrypt_create_iv($numBytes);
}
// Hopefully the above two options cover all our users. But if not, there are
// other platform-specific options we could add.
assert(False, "no suitable random number source available");
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:25,代码来源:Security.php
示例6: addTransaction
private function addTransaction($hash_out, $hash_in, $type, $choice1 = null, $choice2 = null)
{
if ($this->closed) {
throw new \RuntimeException("Could not add the transaction. This batchRequest is closed.");
}
if ($this->isFull()) {
throw new \RuntimeException('The transaction could not be added to the batch. It is full.');
}
if ($type == 'accountUpdate' && $this->counts_and_amounts['accountUpdate']['count'] != $this->total_txns) {
throw new \RuntimeException("The transaction could not be added to the batch. The transaction type {$type} cannot be mixed with non-Account Updates.");
} elseif ($type != 'accountUpdate' && $this->counts_and_amounts['accountUpdate']['count'] == $this->total_txns && $this->total_txns > 0) {
throw new \RuntimeException("The transaction could not be added to the batch. The transaction type {$type} cannot be mixed with AccountUpdates.");
}
if (isset($hash_in['reportGroup'])) {
$report_group = $hash_in['reportGroup'];
} else {
$conf = Obj2xml::getConfig(array());
$report_group = $conf['reportGroup'];
}
Checker::choice($choice1);
Checker::choice($choice2);
$request = Obj2xml::transactionToXml($hash_out, $type, $report_group);
if (file_put_contents($this->transaction_file, $request, FILE_APPEND) === FALSE) {
throw new \RuntimeException("A transaction could not be written to the batch file at {$this->transaction_file}. Please check your privilege.");
}
$this->total_txns += 1;
}
开发者ID:abishekrsrikaanth,项目名称:payto,代码行数:27,代码来源:BatchRequest.php
示例7: define
<?php
require_once 'Checker.php';
define('APP_DIR', __DIR__);
echo 'Checking filesystem permissions:' . PHP_EOL;
$checker = new Checker(APP_DIR);
$checker->result($checker->checkCache(), 'Cache: ');
$checker->result($checker->checkLib(), 'Lib: ');
$checker->result($checker->checkLog(), 'Log: ');
$checker->result($checker->checkInstaller(), 'Installer removed: ');
开发者ID:mathroc,项目名称:php-vfs,代码行数:10,代码来源:Requirements.php
示例8: testAllLevels
/**
* Test for check.
*
* @dataProvider checkerProvider
*/
public function testAllLevels($subject, $codiceFiscaleToCheck, $omocodiaLevel, $expected)
{
$checker = new Checker($subject, array('codiceFiscaleToCheck' => $codiceFiscaleToCheck, 'omocodiaLevel' => $omocodiaLevel));
$actual = $checker->check();
$this->assertEquals($expected, $actual);
}
开发者ID:davidepastore,项目名称:codice-fiscale,代码行数:11,代码来源:CheckerTest.php
示例9: processRequest
private function processRequest($hash_out, $hash_in, $type, $choice1 = null, $choice2 = null)
{
$hash_config = LitleOnlineRequest::overideconfig($hash_in);
$hash = LitleOnlineRequest::getOptionalAttributes($hash_in, $hash_out);
Checker::choice($choice1);
Checker::choice($choice2);
$request = Obj2xml::toXml($hash, $hash_config, $type);
$litleOnlineResponse = $this->newXML->request($request, $hash_config, $this->useSimpleXml);
return $litleOnlineResponse;
}
开发者ID:abishekrsrikaanth,项目名称:payto,代码行数:10,代码来源:LitleOnlineRequest.php
示例10: checkArgNonRoot
/**
* @internal
*
* @param string $argName
* @param mixed $value
* @throws \InvalidArgumentException
*/
static function checkArgNonRoot($argName, $value)
{
Checker::argStringNonEmpty($argName, $value);
$error = self::findErrorNonRoot($value);
if ($error !== null) {
throw new \InvalidArgumentException("'{$argName}': bad path: {$error}: " . Util::q($value));
}
}
开发者ID:Radiergummi,项目名称:anacronism,代码行数:15,代码来源:Path.php
示例11: runWithRetry
/**
* @param int $maxRetries
* The number of times to retry it the action if it fails with one of the transient
* API errors. A value of 1 means we'll try the action once and if it fails, we
* will retry once.
*
* @param callable $action
* The the action you want to retry.
*
* @return mixed
* Whatever is returned by the $action callable.
*/
static function runWithRetry($maxRetries, $action)
{
Checker::argNat("maxRetries", $maxRetries);
$retryDelay = 1;
$numRetries = 0;
while (true) {
try {
return $action();
} catch (Exception_NetworkIO $ex) {
$savedEx = $ex;
} catch (Exception_ServerError $ex) {
$savedEx = $ex;
} catch (Exception_RetryLater $ex) {
$savedEx = $ex;
}
// We maxed out our retries. Propagate the last exception we got.
if ($numRetries >= $maxRetries) {
throw $savedEx;
}
$numRetries++;
sleep($retryDelay);
$retryDelay *= 2;
// Exponential back-off.
}
throw new \RuntimeException("unreachable");
}
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:38,代码来源:RequestUtil.php
示例12: checkArg
/**
* Use this to check that a function argument is of type <code>AppInfo</code>
*
* @internal
*/
static function checkArg($argName, $argValue)
{
if (!$argValue instanceof self) {
Checker::throwError($argName, $argValue, __CLASS__);
}
}
开发者ID:JamesLinus,项目名称:platform,代码行数:11,代码来源:OAuth1AccessToken.php
示例13: litleInternalRecurringRequestType
public static function litleInternalRecurringRequestType($hash_in)
{
if (isset($hash_in)) {
$hash_out = array("subscriptionId" => Checker::requiredField(XmlFields::returnArrayValue($hash_in, "subscriptionId")), "recurringTxnId" => Checker::requiredField(XmlFields::returnArrayValue($hash_in, "recurringTxnId")));
return $hash_out;
}
}
开发者ID:abishekrsrikaanth,项目名称:payto,代码行数:7,代码来源:XmlFields.php
示例14: recyclingRequestType
public static function recyclingRequestType($hash_in)
{
if (isset($hash_in)) {
$hash_out = array("recycleBy" => Checker::requiredField(XmlFields::returnArrayValue($hash_in, "recycleBy")));
return $hash_out;
}
}
开发者ID:nengineer,项目名称:litle-cakePHP-integration,代码行数:7,代码来源:XmlFields.php
示例15: showCheckRes
function showCheckRes()
{
/* update last page */
$_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res"));
$displaySysAdmin = new DisplaySysAdmin();
$comp = loadvar("survey");
$components = loadvar("components");
if ($components == "") {
return $displaySysAdmin->showCheck($displaySysAdmin->displayWarning(Language::messageToolsCompileSelectComponent()));
}
set_time_limit(0);
$messages = array();
$survey = new Survey($comp);
$checker = new Checker($comp);
$compiler = new Compiler($comp, getSurveyVersion($survey));
$sectionmessages = array();
$routingmessages = array();
$variablemessages = array();
$typemessages = array();
$groupmessages = array();
$surveymessages = array();
if (inArray(SURVEY_COMPONENT_ROUTING, $components)) {
$sections = $survey->getSections();
foreach ($sections as $section) {
$mess = $compiler->generateEngine($section->getSeid(), false);
if (sizeof($mess) > 0) {
$routingmessages[$section->getName()] = $mess;
$errors = true;
}
}
}
if (inArray(SURVEY_COMPONENT_SECTION, $components)) {
$sections = $survey->getSections();
foreach ($sections as $section) {
$mess = $checker->checkSection($section, true);
if (sizeof($mess) > 0) {
$sectionmessages[$section->getName()] = $mess;
$errors = true;
}
}
}
if (inArray(SURVEY_COMPONENT_VARIABLE, $components)) {
$vars = $survey->getVariableDescriptives();
foreach ($vars as $var) {
$mess = $checker->checkVariable($var, true);
if (sizeof($mess) > 0) {
$variablemessages[$var->getName()] = $mess;
$errors = true;
}
$mess = $compiler->generateSetFills(array($var), false, false);
if (sizeof($mess) > 0) {
//print_r($mess);
if (isset($variablemessages[$var->getName()])) {
$variablemessages[$var->getName()] = array_merge($variablemessages[$var->getName()], $mess);
} else {
$variablemessages[$var->getName()] = $mess;
}
$errors = true;
}
}
}
if (inArray(SURVEY_COMPONENT_TYPE, $components)) {
$types = $survey->getTypes();
foreach ($types as $type) {
$mess = $checker->checkType($type, true);
if (sizeof($mess) > 0) {
$typemessages[$type->getName()] = $mess;
$errors = true;
}
}
}
if (inArray(SURVEY_COMPONENT_SETTING, $components)) {
$mess = $checker->checkSurvey();
if (sizeof($mess) > 0) {
$surveymessages = $mess;
$errors = true;
}
}
if (inArray(SURVEY_COMPONENT_GROUP, $components)) {
$groups = $survey->getGroups();
foreach ($groups as $group) {
$mess = $checker->checkGroup($group, true);
if (sizeof($mess) > 0) {
$groupmessages[$group->getName()] = $mess;
$errors = true;
}
}
}
$messages = array(Language::labelSections() => $sectionmessages, Language::labelVariables() => $variablemessages, Language::labelTypes() => $typemessages, Language::labelGroups() => $groupmessages, Language::labelSettings() => $surveymessages, Language::LabelRouting() => $routingmessages);
if ($errors) {
$m = '<a data-keyboard="false" data-toggle="modal" data-target="#errorsModal">Show error(s)</a>';
$content .= $displaySysAdmin->displayError(Language::messageToolsCheckNotOk() . " " . $m);
} else {
$content .= $displaySysAdmin->displaySuccess(Language::messageToolsCheckOk());
}
$text = "";
//print_r($messages);
foreach ($messages as $k => $v) {
if (sizeof($v) == 0) {
//$text .= $displaySysAdmin->displaySuccess(Language::messageToolsCheckOk());
//.........这里部分代码省略.........
开发者ID:nubissurveying,项目名称:nubis,代码行数:101,代码来源:sysadmin.php
示例16: _parseEmailArray
/**
* Parse clear email address array
*
* @param string $email
*
* @return array
*/
private function _parseEmailArray($email)
{
$to = explode(',', $email);
$toArray = array();
foreach ($to as $x) {
$x = $this->_parseEmail($x);
if (Checker::CheckEmail($x)) {
$toArray[] = strtolower($x);
}
}
return $toArray;
}
开发者ID:maxwp,项目名称:php-imap,代码行数:19,代码来源:IMAP.class.php
示例17: getName
/**
* Return the last component of a path (the file or folder name).
*
* <code>
* Path::getName("/Misc/Notes.txt") // "Notes.txt"
* Path::getName("/Misc") // "Misc"
* Path::getName("/") // null
* </code>
*
* @param string $path
* The full path you want to get the last component of.
*
* @return null|string
* The last component of `$path` or `null` if the given
* `$path` was `"/"`.
*/
static function getName($path)
{
Checker::argString("path", $path);
if (\substr_compare($path, "/", 0, 1) !== 0) {
throw new \InvalidArgumentException("'path' must start with \"/\"");
}
$l = strlen($path);
if ($l === 1) {
return null;
}
if ($path[$l - 1] === "/") {
throw new \InvalidArgumentException("'path' must not end with \"/\"");
}
$lastSlash = strrpos($path, "/");
return substr($path, $lastSlash + 1);
}
开发者ID:php5-i2ivision,项目名称:dropbox-sdk-php,代码行数:32,代码来源:Path.php
示例18: mposType
public static function mposType($hash_in)
{
if (isset($hash_in)) {
$hash_out = array("ksn" => Checker::requiredField(XmlFields::returnArrayValue($hash_in, "ksn", 1028)), "formatId" => Checker::requiredField(XmlFields::returnArrayValue($hash_in, "formatId", 1028)), "encryptedTrack" => Checker::requiredField(XmlFields::returnArrayValue($hash_in, "encryptedTrack", 1028)), "track1Status" => Checker::requiredField(XmlFields::returnArrayValue($hash_in, "track1Status", 1028)), "track2Status" => Checker::requiredField(XmlFields::returnArrayValue($hash_in, "track2Status", 1028)));
return $hash_out;
}
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:7,代码来源:XmlFields.php
示例19: checkArgOrNull
/**
* Use this to check that a function argument is either `null` or of type
* `AppInfo`.
*
* @internal
*/
static function checkArgOrNull($argName, $argValue)
{
if ($argValue === null) {
return;
}
if (!$argValue instanceof self) {
Checker::throwError($argName, $argValue, __CLASS__);
}
}
开发者ID:Radiergummi,项目名称:anacronism,代码行数:15,代码来源:AppInfo.php
示例20: finish
/**
* Call this after the user has visited the authorize URL returned by {@link start()},
* approved your app, was presented with an authorization code by Dropbox, and has copy/paste'd
* that authorization code into your app.
*
* See <a href="https://www.dropbox.com/developers/core/docs#oa2-token">/oauth2/token</a>.
*
* @param string $code
* The authorization code provided to the user by Dropbox.
*
* @return array
* A <code>list(string $accessToken, string $userId)</code>, where
* <code>$accessToken</code> can be used to construct a {@link Client} and
* <code>$userId</code> is the user ID of the user's Dropbox account.
*
* @throws Exception
* Thrown if there's an error getting the access token from Dropbox.
*/
function finish($code)
{
Checker::argStringNonEmpty("code", $code);
return $this->_finish($code, null);
}
开发者ID:elephantcode,项目名称:elephantcode,代码行数:23,代码来源:WebAuthNoRedirect.php
注:本文中的Checker类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论