Пример #1
0
 public static function bool_to_string($value)
 {
     return \Rhonda\Boolean::evaluate($value) ? '1' : '0';
 }
Пример #2
0
<?php

echo "<h3>\\Rhonda\\Boolean</h3>";
// Evaluate string
echo "'false' evaluates to: " . \Rhonda\Boolean::evaluate("false");
echo "</br>";
$boolean = new \Rhonda\Boolean();
echo "'false' evaluates to: " . $boolean->evaluate("false");
echo "</br>";
// Evaluate string
echo "'0' evaluates to: " . \Rhonda\Boolean::evaluate("0");
echo "</br>";
$boolean = new \Rhonda\Boolean();
echo "'random word' evaluates to: " . $boolean->evaluate("random word");
echo "</br>";
// Evaluate string
echo "'true' evaluates to: " . \Rhonda\Boolean::evaluate("true");
echo "</br>";
$boolean = new \Rhonda\Boolean();
echo "'true' evaluates to: " . $boolean->evaluate("true");
echo "</br>";
// Evaluate string
echo "'yes' evaluates to: " . \Rhonda\Boolean::evaluate("yes");
echo "</br>";
$boolean = new \Rhonda\Boolean();
echo "'1' evaluates to: " . $boolean->evaluate("1");
echo "</br>";
Пример #3
0
 /**
  * transforms query results that should be booleans to boolean literals from
  * 0 or 1 tinyints.
  *
  * @return array
  *
  * @since 2016-7-18
  * @author Matthew Ess <*****@*****.**>
  **/
 private function transform_boolean_values($results)
 {
     foreach ($results as $result) {
         foreach ($this->model_object->get_data_properties() as $property) {
             if (\PDope\Utilities::get_pdo_type_from_generic_type($property->get_type()) == \PDO::PARAM_BOOL) {
                 $property_name = $property->name;
                 $result->{$property_name} = \Rhonda\Boolean::evaluate($result->{$property_name});
             }
         }
     }
     return $results;
 }