@@ -104,7 +104,7 @@ |
||
104 | 104 | $newCostsToTargetVertex = $totalCostOfCheapestPathTo[$currentVertexId] + $weight; |
105 | 105 | |
106 | 106 | if ((!isset($predecesEdgeOfCheapestPathTo[$targetVertexId])) |
107 | - // is the new path cheaper? |
|
107 | + // is the new path cheaper? |
|
108 | 108 | || $totalCostOfCheapestPathTo[$targetVertexId] > $newCostsToTargetVertex) { |
109 | 109 | |
110 | 110 | // Not an update, just a new insert with lower cost |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | if (!isset($totalCostOfCheapestPathTo[$endVertexId])) { |
128 | - throw new MultiDijkstraNoPathException("No path found between vertex '".$startVertex->getId()."' and vertex '".$endVertex->getId()."'"); |
|
128 | + throw new MultiDijkstraNoPathException("No path found between vertex '" . $startVertex->getId() . "' and vertex '" . $endVertex->getId() . "'"); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // algorithm is done, return resulting edges |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | while ($currentVertex !== $startVertex) { |
145 | 145 | $predecessorEdges = $predecesEdgesArray[$currentVertex->getId()]; |
146 | 146 | if (count($predecessorEdges) > 1) { |
147 | - throw new MultiDijkstraAmbiguityException("There are many possible shortest paths to link vertex '".$startVertex->getId()."' to '".$endVertex->getId()."'"); |
|
147 | + throw new MultiDijkstraAmbiguityException("There are many possible shortest paths to link vertex '" . $startVertex->getId() . "' to '" . $endVertex->getId() . "'"); |
|
148 | 148 | } |
149 | 149 | /* @var $edge \Fhaculty\Graph\Edge\Base */ |
150 | 150 | $edge = $predecessorEdges[0]; |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function detectJunctionTables($ignoreReferencedTables = false) |
100 | 100 | { |
101 | - $junctionTablesKey = $this->cachePrefix.'_junctiontables_'.($ignoreReferencedTables ? 'true' : 'false'); |
|
101 | + $junctionTablesKey = $this->cachePrefix . '_junctiontables_' . ($ignoreReferencedTables ? 'true' : 'false'); |
|
102 | 102 | $junctionTables = $this->cache->fetch($junctionTablesKey); |
103 | 103 | if ($junctionTables === false) { |
104 | - $junctionTables = array_filter($this->getSchema()->getTables(), function (Table $table) use ($ignoreReferencedTables) { |
|
104 | + $junctionTables = array_filter($this->getSchema()->getTables(), function(Table $table) use ($ignoreReferencedTables) { |
|
105 | 105 | return $this->isJunctionTable($table, $ignoreReferencedTables); |
106 | 106 | }); |
107 | 107 | $this->cache->save($junctionTablesKey, $junctionTables); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function getShortestPath($fromTable, $toTable) |
214 | 214 | { |
215 | - return $this->fromCache($this->cachePrefix.'_shortest_'.$fromTable.'```'.$toTable, function () use ($fromTable, $toTable) { |
|
215 | + return $this->fromCache($this->cachePrefix . '_shortest_' . $fromTable . '```' . $toTable, function() use ($fromTable, $toTable) { |
|
216 | 216 | return $this->getShortestPathWithoutCache($fromTable, $toTable); |
217 | 217 | }); |
218 | 218 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | private function getSchema() |
336 | 336 | { |
337 | 337 | if ($this->schema === null) { |
338 | - $schemaKey = $this->cachePrefix.'_schema'; |
|
338 | + $schemaKey = $this->cachePrefix . '_schema'; |
|
339 | 339 | $this->schema = $this->cache->fetch($schemaKey); |
340 | 340 | if (empty($this->schema)) { |
341 | 341 | $this->schema = $this->schemaManager->createSchema(); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $textPaths = []; |
358 | 358 | $i = 1; |
359 | 359 | foreach ($paths as $path) { |
360 | - $textPaths[] = 'Path '.$i.': '.$this->getTextualPath($path, $startVertex); |
|
360 | + $textPaths[] = 'Path ' . $i . ': ' . $this->getTextualPath($path, $startVertex); |
|
361 | 361 | ++$i; |
362 | 362 | } |
363 | 363 | |
@@ -395,9 +395,9 @@ discard block |
||
395 | 395 | |
396 | 396 | $columns = implode(',', $fk->getLocalColumns()); |
397 | 397 | |
398 | - $textPath .= ' '.(!$isForward ? '<' : ''); |
|
399 | - $textPath .= '--('.$columns.')--'; |
|
400 | - $textPath .= ($isForward ? '>' : '').' '; |
|
398 | + $textPath .= ' ' . (!$isForward ? '<' : ''); |
|
399 | + $textPath .= '--(' . $columns . ')--'; |
|
400 | + $textPath .= ($isForward ? '>' : '') . ' '; |
|
401 | 401 | $textPath .= $currentTable; |
402 | 402 | } elseif ($junctionTable = $edge->getAttribute('junction')) { |
403 | 403 | /* @var $junctionTable Table */ |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | } else { |
410 | 410 | $currentTable = $fk->getForeignTableName(); |
411 | 411 | } |
412 | - $textPath .= ' <=('.$junctionTable->getName().')=> '.$currentTable; |
|
412 | + $textPath .= ' <=(' . $junctionTable->getName() . ')=> ' . $currentTable; |
|
413 | 413 | } else { |
414 | 414 | // @codeCoverageIgnoreStart |
415 | 415 | throw new SchemaAnalyzerException('Unexpected edge. We should have a fk or a junction attribute.'); |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | */ |
501 | 501 | public function getParentRelationship($tableName) |
502 | 502 | { |
503 | - return $this->fromCache($this->cachePrefix.'_parent_'.$tableName, function () use ($tableName) { |
|
503 | + return $this->fromCache($this->cachePrefix . '_parent_' . $tableName, function() use ($tableName) { |
|
504 | 504 | return $this->getParentRelationshipWithoutCache($tableName); |
505 | 505 | }); |
506 | 506 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | */ |
538 | 538 | public function getChildrenRelationships($tableName) |
539 | 539 | { |
540 | - return $this->fromCache($this->cachePrefix.'_children_'.$tableName, function () use ($tableName) { |
|
540 | + return $this->fromCache($this->cachePrefix . '_children_' . $tableName, function() use ($tableName) { |
|
541 | 541 | return $this->getChildrenRelationshipsWithoutCache($tableName); |
542 | 542 | }); |
543 | 543 | } |