コード例 #1
0
ファイル: EzXmlTest.php プロジェクト: CG77/ezpublish-kernel
 /**
  * @dataProvider providerForTestConvertCorrect
  */
 public function testConvertCorrect($xmlString)
 {
     $input = new EzXml($xmlString);
     $this->assertEquals($xmlString, $input->getInternalRepresentation());
 }
コード例 #2
0
ファイル: Type.php プロジェクト: dfritschy/ezpublish-kernel
 /**
  * Inspects given $inputValue and potentially converts it into a dedicated value object.
  *
  * @param \eZ\Publish\Core\FieldType\XmlText\Value|\eZ\Publish\Core\FieldType\XmlText\Input|string $inputValue
  *
  * @return \eZ\Publish\Core\FieldType\XmlText\Value The potentially converted and structurally plausible value.
  */
 protected function createValueFromInput($inputValue)
 {
     if (is_string($inputValue)) {
         if (empty($inputValue)) {
             $inputValue = Value::EMPTY_VALUE;
         }
         $inputValue = new EzXml($inputValue);
     }
     if ($inputValue instanceof Input) {
         $doc = new DOMDocument();
         $doc->loadXML($inputValue->getInternalRepresentation());
         $inputValue = new Value($doc);
     }
     return $inputValue;
 }