Completed
Push — master ( d1ad50...a1ee40 )
by Yann
02:13
created
src/Models/Document.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -148,15 +148,15 @@
 block discarded – undo
148 148
 	public function toArray() {
149 149
 		$array = [];
150 150
 		$sorter = function($value, $key) use(&$array) {
151
-			if($value instanceof Node) {
151
+			if ($value instanceof Node) {
152 152
 				$value = $value->toArray();
153
-			} elseif($value instanceof DOMDocument) {
153
+			} elseif ($value instanceof DOMDocument) {
154 154
 				return;
155 155
 			}
156 156
 			$array[$key] = $value;
157 157
 		};
158 158
 		
159
-		foreach(get_object_vars($this) as $key => $value) {
159
+		foreach (get_object_vars($this) as $key => $value) {
160 160
 			$sorter($value, $key);
161 161
 		}
162 162
 		
Please login to merge, or discard this patch.
src/Parser.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return Document : The document instance with all its nodes instances.
64 64
 	 */
65 65
 	public function buildDocumentTreeFromFilePath($filePath) {
66
-		if(!file_exists($filePath)) {
66
+		if (!file_exists($filePath)) {
67 67
 			throw new InvalidArgumentException('The given path : "'.$filePath.'" is invalid.');
68 68
 		}
69 69
 		
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	private function fillNode(DOMElement $domNode) {
87 87
 		//The given node name must be self::NODE_NODENAME
88
-		if($domNode->nodeName !== self::NODE_NODENAME) {
88
+		if ($domNode->nodeName !== self::NODE_NODENAME) {
89 89
 			throw new InvalidNodeNameException('The node name must be "node". "'.$domNode->nodeName.'" given.');
90 90
 		}
91 91
 		
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 		
96 96
 		//Build the list of children nodes and fill font information.
97 97
 		$children = new NodeList();
98
-		foreach($domNode->childNodes as $childNode) {
99
-			if($childNode->nodeName === self::NODE_NODENAME) {
98
+		foreach ($domNode->childNodes as $childNode) {
99
+			if ($childNode->nodeName === self::NODE_NODENAME) {
100 100
 				$children->add($this->fillNode($childNode));
101
-			} elseif($childNode->nodeName === self::FONT_NODENAME) {
101
+			} elseif ($childNode->nodeName === self::FONT_NODENAME) {
102 102
 				$this->fillNodeAttributes($childNode->attributes, self::$fontAvailableAttributes, $node);
103
-			} elseif($childNode->nodeName === self::ICON_NODENAME) {
104
-				foreach($childNode->attributes as $attribute) {
105
-					if(array_key_exists($attribute->nodeName, self::$iconAvailableAttributes)) {
103
+			} elseif ($childNode->nodeName === self::ICON_NODENAME) {
104
+				foreach ($childNode->attributes as $attribute) {
105
+					if (array_key_exists($attribute->nodeName, self::$iconAvailableAttributes)) {
106 106
 						$node->setIcon(new Icon($attribute->nodeValue));
107 107
 					}
108 108
 				}
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 * @param array $availableAttributes : One of the static array of this class to describe the list of known attributes.
122 122
 	 * @param Node $node : The Node object to fill in.
123 123
 	 */
124
-	private function fillNodeAttributes (DOMNamedNodeMap $nodeAtributes, array $availableAttributes, Node $node) {
125
-		foreach($nodeAtributes as $attribute) {
126
-			if(array_key_exists($attribute->nodeName, $availableAttributes)) {
124
+	private function fillNodeAttributes(DOMNamedNodeMap $nodeAtributes, array $availableAttributes, Node $node) {
125
+		foreach ($nodeAtributes as $attribute) {
126
+			if (array_key_exists($attribute->nodeName, $availableAttributes)) {
127 127
 				call_user_func([
128 128
 						$node, 
129 129
 						sprintf('openMindParser\Models\Node::set%s', ucfirst($availableAttributes[$attribute->nodeName]))
Please login to merge, or discard this patch.
src/Converters/Model/AbstractConverter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@
 block discarded – undo
19 19
 	 * @return mixed : The result of the conversion.
20 20
 	 */
21 21
 	public function convert($data, $options = []) {
22
-		if(!is_string($data) && !($data instanceof Document)) {
22
+		if (!is_string($data) && !($data instanceof Document)) {
23 23
 			throw new InvalidArgumentException('The $data variable must be of type "string" (the file path), or an instance of "Document".');
24
-		} elseif(!is_array($options)) {
24
+		} elseif (!is_array($options)) {
25 25
 			throw new InvalidArgumentException('The $options variable must be and array.');
26 26
 		}
27 27
 		
28
-		if(is_string($data)) {
28
+		if (is_string($data)) {
29 29
 			$parser = new Parser();
30 30
 			$data = $parser->buildDocumentTreeFromFilePath($data);	
31 31
 		}
Please login to merge, or discard this patch.