示例#1
0
 /**
  * @covers ::format
  */
 public function testPropertyFilter()
 {
     $properties = ['Alpha' => 'false', 'Beta' => 'true'];
     $propertyFilter = new Allowed();
     $propertyFilter->addProperty('Alpha');
     $formatter = new Formatter();
     $formatter->setPropertyFilter($propertyFilter);
     $result = $formatter->format($properties);
     static::assertObjectNotHasAttribute('Beta', $result);
 }
示例#2
0
 /**
  * Optimized constructor.
  *
  * @param bool $returnArray
  */
 public function __construct(bool $returnArray = false)
 {
     $options = self::VALUE_TYPED | self::VALUE_UNKNOWN_TO_NULL;
     if ($returnArray) {
         $options |= self::RETURN_ARRAY;
     } else {
         $options |= self::RETURN_OBJECT;
     }
     parent::__construct($options);
     // Disallow useless properties
     $propertyFilter = new Disallowed();
     $propertyFilter->addProperty('AolVersion');
     $this->setPropertyFilter($propertyFilter);
 }