/**
  * @param Schema   $schema
  * @param Property $property
  * @param string $operationType
  * @return Operation
  */
 public static function factory(Schema $schema, Property $property, $operationType)
 {
     $operation = new self();
     $operation->setType($operationType);
     $operation->setSchema($schema);
     $operation->setPath($property->getPath());
     $operation->setValue($property->getValue());
     return $operation;
 }
Ejemplo n.º 2
0
 public function test_Escaping_Tilde()
 {
     $property = new Property();
     $property->setName('~foo');
     $operation = new Operation();
     $operation->setPath($property->getPath());
     $operation->setType(OperationType::REPLACE);
     $operation->setValue('bar~baz~');
     $encoded = Encoder::encode(array($operation));
     $this->assertEquals('[{"op": "replace", "path": "/~0foo", "value": "bar~0baz~0"}]', $encoded);
 }