@@ -23,7 +23,8 @@ |
||
| 23 | 23 | $this->assertXmlStringEqualsXmlString('<edmx:Edmx xmlns="http://schemas.microsoft.com/ado/2009/11/edm" xmlns:annotations="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:metadata="http://schemas.microsoft.com/ado/2007/08/DataServices/Metadata" Version="1.0"><edmx:DataServices metadata:DataServiceVersion="3.0"><Schema /></edmx:DataServices></edmx:Edmx>', $xml); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function testEdmxSerializePartialSchema(){ |
|
| 26 | + public function testEdmxSerializePartialSchema() |
|
| 27 | + { |
|
| 27 | 28 | $writterContext = new WritterContext(OdataVersions::THREE()); |
| 28 | 29 | $edmx = new Edmx(); |
| 29 | 30 | $schema = new Schema('ODataWebV3.Northwind.Model'); |
@@ -8,7 +8,8 @@ discard block |
||
| 8 | 8 | class EntityContainerTest extends TestCase |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - public static function getEntityContainer(){ |
|
| 11 | + public static function getEntityContainer() |
|
| 12 | + { |
|
| 12 | 13 | $entityContainer = new EntityContainer("NorthwindEntities", true,null,true); |
| 13 | 14 | |
| 14 | 15 | $entitySetarray = [ |
@@ -39,7 +40,7 @@ discard block |
||
| 39 | 40 | ['Summary_of_Sales_by_Quarters','NorthwindModel.Summary_of_Sales_by_Quarter'], |
| 40 | 41 | ['Summary_of_Sales_by_Years','NorthwindModel.Summary_of_Sales_by_Year'], |
| 41 | 42 | ]; |
| 42 | - foreach($entitySetarray as $es){ |
|
| 43 | + foreach($entitySetarray as $es) { |
|
| 43 | 44 | $entityContainer->addToEntitySet(new EntityContainer\EntitySet($es[0],$es[1])); |
| 44 | 45 | } |
| 45 | 46 | $assocationSetArray = [ |
@@ -103,7 +104,8 @@ discard block |
||
| 103 | 104 | return $entityContainer; |
| 104 | 105 | } |
| 105 | 106 | |
| 106 | - public function testXmlSerialize(){ |
|
| 107 | + public function testXmlSerialize() |
|
| 108 | + { |
|
| 107 | 109 | $domNode = $this->TESTNODE; |
| 108 | 110 | $entityContainer = self::getEntityContainer(); |
| 109 | 111 | $domNode = $this->writterContext->write($entityContainer, false); |
@@ -60,10 +60,10 @@ |
||
| 60 | 60 | ]; |
| 61 | 61 | $usingArray = UsingTest::usingTestDataProvider(); |
| 62 | 62 | $data = []; |
| 63 | - foreach($usingArray as $usingItem){ |
|
| 63 | + foreach($usingArray as $usingItem) { |
|
| 64 | 64 | $expected = $usingItem[0]; |
| 65 | 65 | $using = new Using($usingItem[1],$usingItem[2],$usingItem[3]); |
| 66 | - foreach($base as $baseItem){ |
|
| 66 | + foreach($base as $baseItem) { |
|
| 67 | 67 | $data[] = [sprintf($baseItem[0],$expected), $baseItem[1], $baseItem[2], [$using]]; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -25,7 +25,8 @@ |
||
| 25 | 25 | $this->assertEquals($expected, $xml); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public static function documentationTestProvider(){ |
|
| 28 | + public static function documentationTestProvider() |
|
| 29 | + { |
|
| 29 | 30 | return [ |
| 30 | 31 | [ |
| 31 | 32 | '<Documentation><Summary>Short Summery</Summary></Documentation>', 'Short Summery', null |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | public function testKeyElementXmlSerialize($expected, $propertyRefArray) |
| 15 | 15 | { |
| 16 | 16 | $key = new KeyElement(); |
| 17 | - foreach($propertyRefArray as $proRef){ |
|
| 17 | + foreach($propertyRefArray as $proRef) { |
|
| 18 | 18 | $key[]=$proRef; |
| 19 | 19 | } |
| 20 | 20 | $domNode = $this->writterContext->write($key, false); |
@@ -23,7 +23,8 @@ discard block |
||
| 23 | 23 | $this->assertXmlStringEqualsXmlString($expected, $xml); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public static function KeyElementProvider(){ |
|
| 26 | + public static function KeyElementProvider() |
|
| 27 | + { |
|
| 27 | 28 | return [ |
| 28 | 29 | [ |
| 29 | 30 | '<Key>' . |
@@ -130,7 +130,8 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | - public function XmlSerialize(OdataVersions $version){ |
|
| 133 | + public function XmlSerialize(OdataVersions $version) |
|
| 134 | + { |
|
| 134 | 135 | $context = new WritterContext($version); |
| 135 | 136 | $domDocument = $context->getBaseDocument(); |
| 136 | 137 | $edmxElement = $context->createEdmxElement('edmx:Edmx'); |
@@ -142,7 +143,8 @@ discard block |
||
| 142 | 143 | return $domDocument->saveXML(); |
| 143 | 144 | } |
| 144 | 145 | |
| 145 | - private function setUpNamespaces(\DOMElement $edmxElement, WritterContext $context){ |
|
| 146 | + private function setUpNamespaces(\DOMElement $edmxElement, WritterContext $context) |
|
| 147 | + { |
|
| 146 | 148 | $edmxElement->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns', $context->getEdmNamespace()); |
| 147 | 149 | $edmxElement->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:annotations', $context->getAnnotationsNamespace()); |
| 148 | 150 | $edmxElement->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:metadata', $context->getMetadataNamespace()); |
@@ -19,7 +19,6 @@ |
||
| 19 | 19 | * The following is an example of the Schema element: |
| 20 | 20 | * |
| 21 | 21 | * <Schema Alias="Model" Namespace="Test.Simple.Model" xmlns:edm="http://schemas.microsoft.com/ado/2009/11/edm" xmlns="http://schemas.microsoft.com/ado/2009/11/edm"> |
| 22 | - |
|
| 23 | 22 | * The following rules apply to the Schema element. |
| 24 | 23 | * - The CSDL document MUST have the Schema element as its root element. |
| 25 | 24 | * - The Namespace attribute is defined for each Schema element. Namespace is of type QualifiedName. A namespace is a |
@@ -152,8 +152,7 @@ |
||
| 152 | 152 | array $valueTerm = [], |
| 153 | 153 | array $function = [], |
| 154 | 154 | array $annotations = [] |
| 155 | - ) |
|
| 156 | - { |
|
| 155 | + ) { |
|
| 157 | 156 | $this |
| 158 | 157 | ->setNamespace($namespace) |
| 159 | 158 | ->setAlias($alias) |
@@ -53,8 +53,8 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function getAttributesHasUnicode(): array{ |
| 56 | - if(method_exists($this, 'getType')){ |
|
| 57 | - if($this->getType() != 'String'){ |
|
| 56 | + if(method_exists($this, 'getType')) { |
|
| 57 | + if($this->getType() != 'String') { |
|
| 58 | 58 | return []; |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | public function XmlSerializeHasValueAnnotation(DOMElement $thisNode): void |
| 79 | 79 | { |
| 80 | 80 | //TODO: add conext version check |
| 81 | - foreach($this->getValueAnnotation() as $annotation){ |
|
| 81 | + foreach($this->getValueAnnotation() as $annotation) { |
|
| 82 | 82 | $annotation->XmlSerialize($thisNode); |
| 83 | 83 | } |
| 84 | 84 | } |