Skip to content

Commit 5ef8287

Browse files
committed
Fix code style, remove extra whitespaces
1 parent a552724 commit 5ef8287

28 files changed

+192
-192
lines changed

lib/Doctrine/Import/Schema.php

+53-53
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class Doctrine_Import_Schema
154154

155155
/**
156156
* Returns an array of definition keys that can be applied at the global level.
157-
*
157+
*
158158
* @return array
159159
*/
160160
public static function getGlobalDefinitionKeys()
@@ -165,7 +165,7 @@ public static function getGlobalDefinitionKeys()
165165
/**
166166
* getOption
167167
*
168-
* @param string $name
168+
* @param string $name
169169
* @return void
170170
*/
171171
public function getOption($name)
@@ -188,8 +188,8 @@ public function getOptions()
188188
/**
189189
* setOption
190190
*
191-
* @param string $name
192-
* @param string $value
191+
* @param string $name
192+
* @param string $value
193193
* @return void
194194
*/
195195
public function setOption($name, $value)
@@ -198,11 +198,11 @@ public function setOption($name, $value)
198198
$this->_options[$name] = $value;
199199
}
200200
}
201-
201+
202202
/**
203203
* setOptions
204204
*
205-
* @param string $options
205+
* @param array $options
206206
* @return void
207207
*/
208208
public function setOptions($options)
@@ -230,7 +230,7 @@ public function buildSchema($schema, $format)
230230
$e = explode('.', $s);
231231
if (end($e) === $format) {
232232
$array = array_merge($array, $this->parseSchema($s, $format));
233-
}
233+
}
234234
} else if (is_dir($s)) {
235235
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($s),
236236
RecursiveIteratorIterator::LEAVES_ONLY);
@@ -270,20 +270,20 @@ public function importSchema($schema, $format = 'yml', $directory = null, $model
270270
$builder = new Doctrine_Import_Builder();
271271
$builder->setTargetPath($directory);
272272
$builder->setOptions($this->getOptions());
273-
273+
274274
$array = $this->buildSchema($schema, $format);
275275

276-
if (count($array) == 0) {
276+
if (count($array) == 0) {
277277
throw new Doctrine_Import_Exception(
278278
sprintf('No ' . $format . ' schema found in ' . implode(", ", $schema))
279-
);
279+
);
280280
}
281281

282282
foreach ($array as $name => $definition) {
283283
if ( ! empty($models) && !in_array($definition['className'], $models)) {
284284
continue;
285285
}
286-
286+
287287
$builder->buildRecord($definition);
288288
}
289289
}
@@ -313,7 +313,7 @@ public function parseSchema($schema, $type)
313313
'package' => null,
314314
'inheritance' => array(),
315315
'detect_relations' => false);
316-
316+
317317
$array = Doctrine_Parser::load($schema, $type);
318318

319319
// Loop over and build up all the global values and remove them from the array
@@ -431,14 +431,14 @@ public function parseSchema($schema, $type)
431431
$build[$className][$key] = isset($build[$className][$key]) ? $build[$className][$key]:$defaultValue;
432432
}
433433
}
434-
434+
435435
$build[$className]['className'] = $className;
436436
$build[$className]['tableName'] = $tableName;
437437
$build[$className]['columns'] = $columns;
438-
438+
439439
// Make sure that anything else that is specified in the schema makes it to the final array
440440
$build[$className] = Doctrine_Lib::arrayDeepMerge($table, $build[$className]);
441-
441+
442442
// We need to keep track of the className for the connection
443443
$build[$className]['connectionClassName'] = $build[$className]['className'];
444444
}
@@ -448,11 +448,11 @@ public function parseSchema($schema, $type)
448448

449449
/**
450450
* _processInheritance
451-
*
451+
*
452452
* Perform some processing on inheritance.
453453
* Sets the default type and sets some default values for certain types
454454
*
455-
* @param string $array
455+
* @param string $array
456456
* @return void
457457
*/
458458
protected function _processInheritance($array)
@@ -472,9 +472,9 @@ protected function _processInheritance($array)
472472
if ($array[$className]['inheritance']['type'] == 'column_aggregation') {
473473
// Set the keyField to 'type' by default
474474
if ( ! isset($array[$className]['inheritance']['keyField'])) {
475-
$array[$className]['inheritance']['keyField'] = 'type';
475+
$array[$className]['inheritance']['keyField'] = 'type';
476476
}
477-
477+
478478
// Set the keyValue to the name of the child class if it does not exist
479479
if ( ! isset($array[$className]['inheritance']['keyValue'])) {
480480
$array[$className]['inheritance']['keyValue'] = $className;
@@ -510,22 +510,22 @@ protected function _processInheritance($array)
510510

511511
// Populate the parents subclasses
512512
if ($definition['inheritance']['type'] == 'column_aggregation') {
513-
// Fix for 2015: loop through superclasses' inheritance to the base-superclass to
514-
// make sure we collect all keyFields needed (and not only the first)
515-
$inheritanceFields = array($definition['inheritance']['keyField'] => $definition['inheritance']['keyValue']);
513+
// Fix for 2015: loop through superclasses' inheritance to the base-superclass to
514+
// make sure we collect all keyFields needed (and not only the first)
515+
$inheritanceFields = array($definition['inheritance']['keyField'] => $definition['inheritance']['keyValue']);
516516

517-
$superClass = $definition['inheritance']['extends'];
518-
$multiInheritanceDef = $array[$superClass];
517+
$superClass = $definition['inheritance']['extends'];
518+
$multiInheritanceDef = $array[$superClass];
519519

520-
while (count($multiInheritanceDef['inheritance']) > 0 && array_key_exists('extends', $multiInheritanceDef['inheritance']) && $multiInheritanceDef['inheritance']['type'] == 'column_aggregation') {
520+
while (count($multiInheritanceDef['inheritance']) > 0 && array_key_exists('extends', $multiInheritanceDef['inheritance']) && $multiInheritanceDef['inheritance']['type'] == 'column_aggregation') {
521521
$superClass = $multiInheritanceDef['inheritance']['extends'];
522-
522+
523523
// keep original keyField with it's keyValue
524-
if ( ! isset($inheritanceFields[$multiInheritanceDef['inheritance']['keyField']])) {
524+
if ( ! isset($inheritanceFields[$multiInheritanceDef['inheritance']['keyField']])) {
525525
$inheritanceFields[$multiInheritanceDef['inheritance']['keyField']] = $multiInheritanceDef['inheritance']['keyValue'];
526-
}
527-
$multiInheritanceDef = $array[$superClass];
528-
}
526+
}
527+
$multiInheritanceDef = $array[$superClass];
528+
}
529529

530530
$array[$parent]['inheritance']['subclasses'][$definition['className']] = $inheritanceFields;
531531
}
@@ -555,10 +555,10 @@ protected function _findBaseSuperClass($array, $class)
555555
* buildRelationships
556556
*
557557
* Loop through an array of schema information and build all the necessary relationship information
558-
* Will attempt to auto complete relationships and simplify the amount of information required
558+
* Will attempt to auto complete relationships and simplify the amount of information required
559559
* for defining a relationship
560560
*
561-
* @param string $array
561+
* @param string $array
562562
* @return void
563563
*/
564564
protected function _buildRelationships($array)
@@ -591,18 +591,18 @@ protected function _buildRelationships($array)
591591
if ( ! isset($properties['relations'])) {
592592
continue;
593593
}
594-
594+
595595
$className = $properties['className'];
596596
$relations = $properties['relations'];
597-
597+
598598
foreach ($relations as $alias => $relation) {
599599
$class = isset($relation['class']) ? $relation['class']:$alias;
600600
if ( ! isset($array[$class])) {
601601
continue;
602602
}
603603
$relation['class'] = $class;
604604
$relation['alias'] = isset($relation['alias']) ? $relation['alias'] : $alias;
605-
605+
606606
// Attempt to guess the local and foreign
607607
if (isset($relation['refClass'])) {
608608
$relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine_Inflector::tableize($name) . '_id';
@@ -611,11 +611,11 @@ protected function _buildRelationships($array)
611611
$relation['local'] = isset($relation['local']) ? $relation['local']:Doctrine_Inflector::tableize($relation['class']) . '_id';
612612
$relation['foreign'] = isset($relation['foreign']) ? $relation['foreign']:'id';
613613
}
614-
614+
615615
if (isset($relation['refClass'])) {
616616
$relation['type'] = 'many';
617617
}
618-
618+
619619
if (isset($relation['type']) && $relation['type']) {
620620
$relation['type'] = $relation['type'] === 'one' ? Doctrine_Relation::ONE:Doctrine_Relation::MANY;
621621
} else {
@@ -625,26 +625,26 @@ protected function _buildRelationships($array)
625625
if (isset($relation['foreignType']) && $relation['foreignType']) {
626626
$relation['foreignType'] = $relation['foreignType'] === 'one' ? Doctrine_Relation::ONE:Doctrine_Relation::MANY;
627627
}
628-
628+
629629
$relation['key'] = $this->_buildUniqueRelationKey($relation);
630-
630+
631631
$this->_validateSchemaElement('relation', array_keys($relation), $className . '->relation->' . $relation['alias']);
632-
632+
633633
$this->_relations[$className][$alias] = $relation;
634634
}
635635
}
636-
636+
637637
// Now we auto-complete opposite ends of relationships
638638
$this->_autoCompleteOppositeRelations();
639-
639+
640640
// Make sure we do not have any duplicate relations
641641
$this->_fixDuplicateRelations();
642642

643643
// Set the full array of relationships for each class to the final array
644644
foreach ($this->_relations as $className => $relations) {
645645
$array[$className]['relations'] = $relations;
646646
}
647-
647+
648648
return $array;
649649
}
650650

@@ -663,22 +663,22 @@ protected function _autoCompleteOppositeRelations()
663663
if ((isset($relation['equal']) && $relation['equal']) || (isset($relation['autoComplete']) && $relation['autoComplete'] === false)) {
664664
continue;
665665
}
666-
666+
667667
$newRelation = array();
668668
$newRelation['foreign'] = $relation['local'];
669669
$newRelation['local'] = $relation['foreign'];
670670
$newRelation['class'] = isset($relation['foreignClass']) ? $relation['foreignClass']:$className;
671671
$newRelation['alias'] = isset($relation['foreignAlias']) ? $relation['foreignAlias']:$className;
672672
$newRelation['foreignAlias'] = $alias;
673-
673+
674674
// this is so that we know that this relation was autogenerated and
675675
// that we do not need to include it if it is explicitly declared in the schema by the users.
676-
$newRelation['autogenerated'] = true;
677-
676+
$newRelation['autogenerated'] = true;
677+
678678
if (isset($relation['refClass'])) {
679679
$newRelation['refClass'] = $relation['refClass'];
680680
$newRelation['type'] = isset($relation['foreignType']) ? $relation['foreignType']:$relation['type'];
681-
} else {
681+
} else {
682682
if (isset($relation['foreignType'])) {
683683
$newRelation['type'] = $relation['foreignType'];
684684
} else {
@@ -720,7 +720,7 @@ protected function _fixDuplicateRelations()
720720
}
721721
}
722722
}
723-
723+
724724
$this->_relations[$className] = $uniqueRelations;
725725
}
726726
}
@@ -731,7 +731,7 @@ protected function _fixDuplicateRelations()
731731
* Build a unique key to identify a relationship by
732732
* Md5 hash of all the relationship parameters
733733
*
734-
* @param string $relation
734+
* @param string $relation
735735
* @return void
736736
*/
737737
protected function _buildUniqueRelationKey($relation)
@@ -742,8 +742,8 @@ protected function _buildUniqueRelationKey($relation)
742742
/**
743743
* _validateSchemaElement
744744
*
745-
* @param string $name
746-
* @param string $value
745+
* @param string $name
746+
* @param string $value
747747
* @return void
748748
*/
749749
protected function _validateSchemaElement($name, $element, $path)
@@ -768,4 +768,4 @@ protected function _validateSchemaElement($name, $element, $path)
768768
}
769769
}
770770
}
771-
}
771+
}

lib/Doctrine/Parser.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ abstract public function dumpData($array, $path = null, $charset = null);
6262
* Get instance of the specified parser
6363
*
6464
* @param string $type
65-
* @return void
65+
* @return Doctrine_Parser
6666
* @author Jonathan H. Wage
6767
*/
6868
static public function getParser($type)
@@ -94,7 +94,7 @@ static public function load($path, $type = 'xml', $charset = 'UTF-8')
9494
*
9595
* Interface for pulling and dumping data to a file
9696
*
97-
* @param string $array
97+
* @param array $array
9898
* @param string $path
9999
* @param string $type
100100
* @param string $charset The charset of the data being dumped
@@ -115,7 +115,7 @@ static public function dump($array, $type = 'xml', $path = null, $charset = null
115115
* Either should allow php code in it.
116116
*
117117
* @param string $path
118-
* @return void
118+
* @return false|string
119119
*/
120120
public function doLoad($path)
121121
{

tests/BaseTestCase.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testAggressiveModelLoading()
4545

4646
// Make sure it does not include the base classes
4747
$this->assertTrue( ! isset($models['BaseAggressiveModelLoadingUser']));
48-
48+
4949
$filteredModels = Doctrine_Core::filterInvalidModels($models);
5050

5151
// Make sure filterInvalidModels filters out base abstract classes
@@ -85,7 +85,7 @@ public function testModelLoadingCacheInformation()
8585
$this->assertTrue(in_array('AggressiveModelLoadingUser', $models));
8686
$this->assertTrue(in_array('ConservativeModelLoadingProfile', $models));
8787
$this->assertTrue(in_array('ConservativeModelLoadingContact', $models));
88-
88+
8989
$modelFiles = Doctrine_Core::getLoadedModelFiles();
9090
$this->assertTrue(file_exists($modelFiles['ConservativeModelLoadingUser']));
9191
$this->assertTrue(file_exists($modelFiles['ConservativeModelLoadingProfile']));

0 commit comments

Comments
 (0)