本文整理汇总了PHP中StringHelper::booleanValue方法的典型用法代码示例。如果您正苦于以下问题:PHP StringHelper::booleanValue方法的具体用法?PHP StringHelper::booleanValue怎么用?PHP StringHelper::booleanValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringHelper
的用法示例。
在下文中一共展示了StringHelper::booleanValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setShowSniffs
/**
* Sets the flag if the used sniffs should be listed
* @param boolean $show
*/
public function setShowSniffs($show)
{
$this->showSniffs = StringHelper::booleanValue($show);
}
示例2: setExpandDirectives
/**
* Sets whether directives should be expanded as well as variables.
*
* @param bool Whether to expand directives in the input string.
*/
public function setExpandDirectives($expandDirectives)
{
$this->expandDirectives = StringHelper::booleanValue($expandDirectives);
}
示例3: setAttribute
/** Sets the named attribute. */
function setAttribute(Project $project, $element, $attributeName, &$value)
{
// we want to check whether the value we are setting looks like
// a slot-listener variable: %{task.current_file}
//
// slot-listener variables are not like properties, in that they cannot be mixed with
// other text values. The reason for this disparity is that properties are only
// set when first constructing objects from XML, whereas slot-listeners are always dynamic.
//
// This is made possible by PHP5 (objects automatically passed by reference) and PHP's loose
// typing.
if (StringHelper::isSlotVar($value)) {
$as = "setlistening" . strtolower($attributeName);
if (!isset($this->slotListeners[$as])) {
$msg = $this->getElementName($project, $element) . " doesn't support a slot-listening '{$attributeName}' attribute.";
throw new BuildException($msg);
}
$method = $this->slotListeners[$as];
$key = StringHelper::slotVar($value);
$value = Register::getSlot($key);
// returns a RegisterSlot object which will hold current value of that register (accessible using getValue())
} else {
// Traditional value options
$as = "set" . strtolower($attributeName);
if (!isset($this->attributeSetters[$as])) {
$msg = $this->getElementName($project, $element) . " doesn't support the '{$attributeName}' attribute.";
throw new BuildException($msg);
}
$method = $this->attributeSetters[$as];
if ($as == "setrefid") {
$value = new Reference($value);
} else {
// decode any html entities in string
$value = html_entity_decode($value);
// value is a string representation of a boolean type,
// convert it to primitive
if (StringHelper::isBoolean($value)) {
$value = StringHelper::booleanValue($value);
}
// does method expect a PhingFile object? if so, then
// pass a project-relative file.
$params = $method->getParameters();
$classname = null;
if (($hint = $params[0]->getClass()) !== null) {
$classname = $hint->getName();
}
// there should only be one param; we'll just assume ....
if ($classname !== null) {
switch (strtolower($classname)) {
case "phingfile":
$value = $project->resolveFile($value);
break;
case "path":
$value = new Path($project, $value);
break;
case "reference":
$value = new Reference($value);
break;
// any other object params we want to support should go here ...
}
}
// if hint !== null
}
// if not setrefid
}
// if is slot-listener
try {
$project->log(" -calling setter " . $method->getDeclaringClass()->getName() . "::" . $method->getName() . "()", PROJECT_MSG_DEBUG);
$method->invoke($element, $value);
} catch (Exception $exc) {
throw new BuildException($exc);
}
}
示例4: setShowWarnings
/**
* Sets the flag if warnings should be shown
* @param boolean $show
*/
public function setShowWarnings($show)
{
$this->showWarnings = StringHelper::booleanValue($show);
}
示例5: setVerbose
/**
* Sets whether to enable detailed logging or not
*
* @param boolean $verbose
*/
public function setVerbose($verbose)
{
$this->_verbose = StringHelper::booleanValue($verbose);
}
示例6: setHaltonerror
/**
* Sets the flag if test execution should stop in the event of a failure.
*
* @param bool $stop If all tests should stop on failure.
*
* @return void
*/
public function setHaltonerror($stop)
{
$this->haltonerror = StringHelper::booleanValue($stop);
}
示例7: getRecorder
/**
* Gets the recorder that's associated with the passed in name. If the
* recorder doesn't exist, then a new one is created.
* @param string $name the name of the recorder
* @param Project $proj the current project
* @return RecorderEntry a recorder
* @throws BuildException on error
*/
protected function getRecorder($name, Project $proj)
{
// create a recorder entry
$entry = isset(self::$recorderEntries[$name]) ? self::$recorderEntries[$name] : new RecorderEntry($name);
if ($this->append == null) {
$entry->openFile(false);
} else {
$entry->openFile(StringHelper::booleanValue($this->append));
}
$entry->setProject($proj);
self::$recorderEntries[$name] = $entry;
return $entry;
}
示例8: setPassthru
/**
* Whether to check the liquibase return code.
*
* @param $passthru
* @internal param bool $checkreturn
*/
public function setPassthru($passthru)
{
$this->passthru = StringHelper::booleanValue($passthru);
}
示例9: setUpdate
/**
* Sets whether this task will overwrite or update the file.
*
* @param boolean Whether the file should be updated or replaced.
*/
public function setUpdate($update)
{
$this->update = StringHelper::booleanValue($update);
}
示例10: setUseScssphp
/**
* Whether to use the scssphp compiler.
*
* @param string $value Jenkins style boolean value.
*
* @return void
* @link http://leafo.github.io/scssphp/
*/
public function setUseScssphp($value)
{
$this->useScssphp = StringHelper::booleanValue($value);
if (version_compare(PHP_VERSION, '5.2', '<=')) {
$this->useScssphp = false;
$this->log("SCSSPHP is incompatible with this version of PHP", Project::MSG_INFO);
}
}
示例11: setAll
/**
* Set whether all files are to be reverted.
*
* @param string $value Jenkins style boolean value
*
* @return void
*/
public function setAll($value)
{
$this->all = StringHelper::booleanValue($value);
}
示例12: setUseExistingAsDefault
/**
* Sets whether to use the existing value for the property as the default
* value for the prompt.
*
* @param bool Whether to use the existing property value as the
* default.
*/
public function setUseExistingAsDefault($useExistingAsDefault)
{
$this->useExistingAsDefault = StringHelper::booleanValue($useExistingAsDefault);
}
示例13: setQuiet
/**
* Sets whether log messages for this task will be suppressed.
*
* @param bool Whether to suppressing log messages for this task.
*/
public function setQuiet($quiet)
{
$this->quiet = StringHelper::booleanValue($quiet);
}
示例14: init
/**
* Executes initialization actions required to setup the data structures
* related to the tag.
* <p>
* This includes:
* <ul>
* <li>creation of the target object</li>
* <li>calling the setters for attributes</li>
* <li>adding the target to the project</li>
* <li>adding a reference to the target (if id attribute is given)</li>
* </ul>
*
* @param $tag
* @param $attrs
* @throws BuildException
* @throws ExpatParseException
* @internal param the $string tag that comes in
* @internal param attributes $array the tag carries
*/
public function init($tag, $attrs)
{
$name = null;
$depends = "";
$ifCond = null;
$unlessCond = null;
$id = null;
$description = null;
$isHidden = false;
$logskipped = false;
foreach ($attrs as $key => $value) {
switch ($key) {
case "name":
$name = (string) $value;
break;
case "depends":
$depends = (string) $value;
break;
case "if":
$ifCond = (string) $value;
break;
case "unless":
$unlessCond = (string) $value;
break;
case "id":
$id = (string) $value;
break;
case "hidden":
$isHidden = $value == 'true' || $value == '1' ? true : false;
break;
case "description":
$description = (string) $value;
break;
case "logskipped":
$logskipped = $value;
break;
default:
throw new ExpatParseException("Unexpected attribute '{$key}'", $this->parser->getLocation());
}
}
if ($name === null) {
throw new ExpatParseException("target element appears without a name attribute", $this->parser->getLocation());
}
// shorthand
$project = $this->configurator->project;
// check to see if this target is a dup within the same file
if (isset($this->context->getCurrentTargets[$name])) {
throw new BuildException("Duplicate target: {$name}", $this->parser->getLocation());
}
$this->target = new Target();
$this->target->setHidden($isHidden);
$this->target->setIf($ifCond);
$this->target->setUnless($unlessCond);
$this->target->setDescription($description);
$this->target->setLogSkipped(StringHelper::booleanValue($logskipped));
// take care of dependencies
if (strlen($depends) > 0) {
$this->target->setDepends($depends);
}
// check to see if target with same name is already defined
$projectTargets = $project->getTargets();
if (isset($projectTargets[$name])) {
if ($this->configurator->isIgnoringProjectTag() && $this->configurator->getCurrentProjectName() != null && strlen($this->configurator->getCurrentProjectName()) != 0) {
// In an impored file (and not completely
// ignoring the project tag)
$newName = $this->configurator->getCurrentProjectName() . "." . $name;
$project->log("Already defined in main or a previous import, " . "define {$name} as {$newName}", Project::MSG_VERBOSE);
$name = $newName;
} else {
$project->log("Already defined in main or a previous import, " . "ignore {$name}", Project::MSG_VERBOSE);
$name = null;
}
}
if ($name != null) {
$this->target->setName($name);
$project->addOrReplaceTarget($name, $this->target);
if ($id !== null && $id !== "") {
$project->addReference($id, $this->target);
}
}
}
示例15: setShowheaders
/**
* Set the showheaders attribute.
* @param boolean $v
*/
public function setShowheaders($v)
{
$this->showheaders = StringHelper::booleanValue($v);
}