@@ -92,8 +92,9 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function setUpdateInterval($updateInterval) |
| 94 | 94 | { |
| 95 | - if ($updateInterval <= 0) |
|
| 96 | - throw new \RuntimeException('Invalid update interval specified'); |
|
| 95 | + if ($updateInterval <= 0) { |
|
| 96 | + throw new \RuntimeException('Invalid update interval specified'); |
|
| 97 | + } |
|
| 97 | 98 | |
| 98 | 99 | $this->_updateInterval = $updateInterval; |
| 99 | 100 | } |
@@ -133,8 +134,9 @@ discard block |
||
| 133 | 134 | */ |
| 134 | 135 | public function setListenPort($listenPort) |
| 135 | 136 | { |
| 136 | - if ($listenPort < 1 || $listenPort > 65535) |
|
| 137 | - throw new \RuntimeException('Invalid port specified'); |
|
| 137 | + if ($listenPort < 1 || $listenPort > 65535) { |
|
| 138 | + throw new \RuntimeException('Invalid port specified'); |
|
| 139 | + } |
|
| 138 | 140 | |
| 139 | 141 | $this->_listenPort = $listenPort; |
| 140 | 142 | } |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | if ($configuration === false) |
| 143 | 143 | throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
| 144 | 144 | |
| 145 | - $instances = []; |
|
| 145 | + $instances = []; |
|
| 146 | 146 | |
| 147 | 147 | // Parse sections |
| 148 | 148 | foreach ($configuration as $section => $values) |
@@ -124,23 +124,26 @@ discard block |
||
| 124 | 124 | private function parseConfiguration(InputInterface $input) |
| 125 | 125 | { |
| 126 | 126 | // Check that the configuration file exists |
| 127 | - if (!file_exists($input->getArgument('configFile'))) |
|
| 128 | - throw new InvalidConfigurationException('The specified configuration file does not exist'); |
|
| 127 | + if (!file_exists($input->getArgument('configFile'))) { |
|
| 128 | + throw new InvalidConfigurationException('The specified configuration file does not exist'); |
|
| 129 | + } |
|
| 129 | 130 | |
| 130 | 131 | // Check that the database exists and is writable |
| 131 | 132 | $databasePath = $input->getArgument('databaseFile'); |
| 132 | 133 | |
| 133 | - if (!file_exists($databasePath)) |
|
| 134 | - throw new InvalidConfigurationException('The specified database path does not exist'); |
|
| 135 | - else if (!is_writable($databasePath)) |
|
| 136 | - throw new InvalidConfigurationException('The specified database path is not writable'); |
|
| 134 | + if (!file_exists($databasePath)) { |
|
| 135 | + throw new InvalidConfigurationException('The specified database path does not exist'); |
|
| 136 | + } else if (!is_writable($databasePath)) { |
|
| 137 | + throw new InvalidConfigurationException('The specified database path is not writable'); |
|
| 138 | + } |
|
| 137 | 139 | |
| 138 | 140 | // Parse the configuration file |
| 139 | 141 | $configuration = parse_ini_file($input->getArgument('configFile'), true); |
| 140 | 142 | |
| 141 | 143 | // Check that the file was parsed |
| 142 | - if ($configuration === false) |
|
| 143 | - throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
|
| 144 | + if ($configuration === false) { |
|
| 145 | + throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
|
| 146 | + } |
|
| 144 | 147 | |
| 145 | 148 | $instances = []; |
| 146 | 149 | |
@@ -157,12 +160,14 @@ discard block |
||
| 157 | 160 | $instance = new Instance($name, $address, $port); |
| 158 | 161 | |
| 159 | 162 | // Optionally set ignored users |
| 160 | - if (isset($values['ignoredUsers'])) |
|
| 161 | - $instance->setIgnoredUsers($values['ignoredUsers']); |
|
| 163 | + if (isset($values['ignoredUsers'])) { |
|
| 164 | + $instance->setIgnoredUsers($values['ignoredUsers']); |
|
| 165 | + } |
|
| 162 | 166 | |
| 163 | 167 | // Optionally set credentials |
| 164 | - if (isset($values['username']) && isset($values['password'])) |
|
| 165 | - $instance->setCredentials($values['username'], $values['password']); |
|
| 168 | + if (isset($values['username']) && isset($values['password'])) { |
|
| 169 | + $instance->setCredentials($values['username'], $values['password']); |
|
| 170 | + } |
|
| 166 | 171 | |
| 167 | 172 | $instances[] = $instance; |
| 168 | 173 | break; |
@@ -170,8 +175,9 @@ discard block |
||
| 170 | 175 | } |
| 171 | 176 | |
| 172 | 177 | // Validate the configuration. We need at least one instance. |
| 173 | - if (empty($instances)) |
|
| 174 | - throw new InvalidConfigurationException('No instances defined, you need to specify at least one instance'); |
|
| 178 | + if (empty($instances)) { |
|
| 179 | + throw new InvalidConfigurationException('No instances defined, you need to specify at least one instance'); |
|
| 180 | + } |
|
| 175 | 181 | |
| 176 | 182 | // Create the configuration object |
| 177 | 183 | $config = new Configuration($databasePath, $instances); |
@@ -200,8 +206,9 @@ discard block |
||
| 200 | 206 | */ |
| 201 | 207 | private static function getSectionType($section) |
| 202 | 208 | { |
| 203 | - if (substr($section, 0, 8) === 'instance') |
|
| 204 | - return Configuration::SECTION_TYPE_INSTANCE; |
|
| 209 | + if (substr($section, 0, 8) === 'instance') { |
|
| 210 | + return Configuration::SECTION_TYPE_INSTANCE; |
|
| 211 | + } |
|
| 205 | 212 | |
| 206 | 213 | throw new InvalidConfigurationException('Unknown section "' . $section . '"'); |
| 207 | 214 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $propertyNames = []; |
| 331 | 331 | $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); |
| 332 | 332 | |
| 333 | - foreach($serializableProperties as $property) { |
|
| 333 | + foreach ($serializableProperties as $property) { |
|
| 334 | 334 | $propertyNames[] = $property->getName(); |
| 335 | 335 | } |
| 336 | 336 | |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME); |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - $con->transaction(function () use ($con) { |
|
| 575 | + $con->transaction(function() use ($con) { |
|
| 576 | 576 | $deleteQuery = ChildChannelQuery::create() |
| 577 | 577 | ->filterByPrimaryKey($this->getPrimaryKey()); |
| 578 | 578 | $ret = $this->preDelete($con); |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME); |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | - return $con->transaction(function () use ($con) { |
|
| 610 | + return $con->transaction(function() use ($con) { |
|
| 611 | 611 | $isInsert = $this->isNew(); |
| 612 | 612 | $ret = $this->preSave($con); |
| 613 | 613 | if ($isInsert) { |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | $key = 'Instance'; |
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
| 871 | + $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
| 872 | 872 | } |
| 873 | 873 | if (null !== $this->collSubscriptions) { |
| 874 | 874 | |
@@ -1273,7 +1273,7 @@ discard block |
||
| 1273 | 1273 | public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null) |
| 1274 | 1274 | { |
| 1275 | 1275 | $partial = $this->collSubscriptionsPartial && !$this->isNew(); |
| 1276 | - if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
| 1276 | + if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
| 1277 | 1277 | if ($this->isNew() && null === $this->collSubscriptions) { |
| 1278 | 1278 | // return empty collection |
| 1279 | 1279 | $this->initSubscriptions(); |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | */ |
| 1412 | 1412 | protected function doAddSubscription(ChildSubscription $subscription) |
| 1413 | 1413 | { |
| 1414 | - $this->collSubscriptions[]= $subscription; |
|
| 1414 | + $this->collSubscriptions[] = $subscription; |
|
| 1415 | 1415 | $subscription->setChannel($this); |
| 1416 | 1416 | } |
| 1417 | 1417 | |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions; |
| 1429 | 1429 | $this->subscriptionsScheduledForDeletion->clear(); |
| 1430 | 1430 | } |
| 1431 | - $this->subscriptionsScheduledForDeletion[]= clone $subscription; |
|
| 1431 | + $this->subscriptionsScheduledForDeletion[] = clone $subscription; |
|
| 1432 | 1432 | $subscription->setChannel(null); |
| 1433 | 1433 | } |
| 1434 | 1434 | |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | |
| 621 | 621 | // use transaction because $criteria could contain info |
| 622 | 622 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
| 623 | - return $con->transaction(function () use ($con) { |
|
| 623 | + return $con->transaction(function() use ($con) { |
|
| 624 | 624 | $affectedRows = 0; // initialize var to track total num of affected rows |
| 625 | 625 | $affectedRows += parent::doDeleteAll($con); |
| 626 | 626 | // Because this db requires some delete cascade/set null emulation, we have to |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | // use transaction because $criteria could contain info |
| 657 | 657 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
| 658 | - return $con->transaction(function () use ($con, $criteria) { |
|
| 658 | + return $con->transaction(function() use ($con, $criteria) { |
|
| 659 | 659 | $affectedRows = 0; // initialize var to track total num of affected rows |
| 660 | 660 | |
| 661 | 661 | UserTableMap::removeInstanceFromPool($criteria); |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $propertyNames = []; |
| 344 | 344 | $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); |
| 345 | 345 | |
| 346 | - foreach($serializableProperties as $property) { |
|
| 346 | + foreach ($serializableProperties as $property) { |
|
| 347 | 347 | $propertyNames[] = $property->getName(); |
| 348 | 348 | } |
| 349 | 349 | |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME); |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | - $con->transaction(function () use ($con) { |
|
| 703 | + $con->transaction(function() use ($con) { |
|
| 704 | 704 | $deleteQuery = ChildConnectionQuery::create() |
| 705 | 705 | ->filterByPrimaryKey($this->getPrimaryKey()); |
| 706 | 706 | $ret = $this->preDelete($con); |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME); |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | - return $con->transaction(function () use ($con) { |
|
| 738 | + return $con->transaction(function() use ($con) { |
|
| 739 | 739 | $isInsert = $this->isNew(); |
| 740 | 740 | $ret = $this->preSave($con); |
| 741 | 741 | if ($isInsert) { |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | $key = 'Instance'; |
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | - $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
| 1023 | + $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
| 1024 | 1024 | } |
| 1025 | 1025 | if (null !== $this->aUser) { |
| 1026 | 1026 | |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | $key = 'User'; |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | - $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
| 1038 | + $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
| 1039 | 1039 | } |
| 1040 | 1040 | } |
| 1041 | 1041 | |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | |
| 621 | 621 | // use transaction because $criteria could contain info |
| 622 | 622 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
| 623 | - return $con->transaction(function () use ($con) { |
|
| 623 | + return $con->transaction(function() use ($con) { |
|
| 624 | 624 | $affectedRows = 0; // initialize var to track total num of affected rows |
| 625 | 625 | $affectedRows += parent::doDeleteAll($con); |
| 626 | 626 | // Because this db requires some delete cascade/set null emulation, we have to |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | // use transaction because $criteria could contain info |
| 657 | 657 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
| 658 | - return $con->transaction(function () use ($con, $criteria) { |
|
| 658 | + return $con->transaction(function() use ($con, $criteria) { |
|
| 659 | 659 | $affectedRows = 0; // initialize var to track total num of affected rows |
| 660 | 660 | |
| 661 | 661 | UserTableMap::removeInstanceFromPool($criteria); |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | |
| 621 | 621 | // use transaction because $criteria could contain info |
| 622 | 622 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
| 623 | - return $con->transaction(function () use ($con) { |
|
| 623 | + return $con->transaction(function() use ($con) { |
|
| 624 | 624 | $affectedRows = 0; // initialize var to track total num of affected rows |
| 625 | 625 | $affectedRows += parent::doDeleteAll($con); |
| 626 | 626 | // Because this db requires some delete cascade/set null emulation, we have to |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | // use transaction because $criteria could contain info |
| 657 | 657 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
| 658 | - return $con->transaction(function () use ($con, $criteria) { |
|
| 658 | + return $con->transaction(function() use ($con, $criteria) { |
|
| 659 | 659 | $affectedRows = 0; // initialize var to track total num of affected rows |
| 660 | 660 | |
| 661 | 661 | UserTableMap::removeInstanceFromPool($criteria); |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | |
| 621 | 621 | // use transaction because $criteria could contain info |
| 622 | 622 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
| 623 | - return $con->transaction(function () use ($con) { |
|
| 623 | + return $con->transaction(function() use ($con) { |
|
| 624 | 624 | $affectedRows = 0; // initialize var to track total num of affected rows |
| 625 | 625 | $affectedRows += parent::doDeleteAll($con); |
| 626 | 626 | // Because this db requires some delete cascade/set null emulation, we have to |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | // use transaction because $criteria could contain info |
| 657 | 657 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
| 658 | - return $con->transaction(function () use ($con, $criteria) { |
|
| 658 | + return $con->transaction(function() use ($con, $criteria) { |
|
| 659 | 659 | $affectedRows = 0; // initialize var to track total num of affected rows |
| 660 | 660 | |
| 661 | 661 | UserTableMap::removeInstanceFromPool($criteria); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $propertyNames = []; |
| 346 | 346 | $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); |
| 347 | 347 | |
| 348 | - foreach($serializableProperties as $property) { |
|
| 348 | + foreach ($serializableProperties as $property) { |
|
| 349 | 349 | $propertyNames[] = $property->getName(); |
| 350 | 350 | } |
| 351 | 351 | |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | - $con->transaction(function () use ($con) { |
|
| 592 | + $con->transaction(function() use ($con) { |
|
| 593 | 593 | $deleteQuery = ChildUserQuery::create() |
| 594 | 594 | ->filterByPrimaryKey($this->getPrimaryKey()); |
| 595 | 595 | $ret = $this->preDelete($con); |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | - return $con->transaction(function () use ($con) { |
|
| 627 | + return $con->transaction(function() use ($con) { |
|
| 628 | 628 | $isInsert = $this->isNew(); |
| 629 | 629 | $ret = $this->preSave($con); |
| 630 | 630 | if ($isInsert) { |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | $key = 'Instance'; |
| 905 | 905 | } |
| 906 | 906 | |
| 907 | - $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
| 907 | + $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
| 908 | 908 | } |
| 909 | 909 | if (null !== $this->collConnections) { |
| 910 | 910 | |
@@ -1333,7 +1333,7 @@ discard block |
||
| 1333 | 1333 | public function getConnections(Criteria $criteria = null, ConnectionInterface $con = null) |
| 1334 | 1334 | { |
| 1335 | 1335 | $partial = $this->collConnectionsPartial && !$this->isNew(); |
| 1336 | - if (null === $this->collConnections || null !== $criteria || $partial) { |
|
| 1336 | + if (null === $this->collConnections || null !== $criteria || $partial) { |
|
| 1337 | 1337 | if ($this->isNew() && null === $this->collConnections) { |
| 1338 | 1338 | // return empty collection |
| 1339 | 1339 | $this->initConnections(); |
@@ -1471,7 +1471,7 @@ discard block |
||
| 1471 | 1471 | */ |
| 1472 | 1472 | protected function doAddConnection(ChildConnection $connection) |
| 1473 | 1473 | { |
| 1474 | - $this->collConnections[]= $connection; |
|
| 1474 | + $this->collConnections[] = $connection; |
|
| 1475 | 1475 | $connection->setUser($this); |
| 1476 | 1476 | } |
| 1477 | 1477 | |
@@ -1488,7 +1488,7 @@ discard block |
||
| 1488 | 1488 | $this->connectionsScheduledForDeletion = clone $this->collConnections; |
| 1489 | 1489 | $this->connectionsScheduledForDeletion->clear(); |
| 1490 | 1490 | } |
| 1491 | - $this->connectionsScheduledForDeletion[]= $connection; |
|
| 1491 | + $this->connectionsScheduledForDeletion[] = $connection; |
|
| 1492 | 1492 | $connection->setUser(null); |
| 1493 | 1493 | } |
| 1494 | 1494 | |
@@ -1583,7 +1583,7 @@ discard block |
||
| 1583 | 1583 | public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null) |
| 1584 | 1584 | { |
| 1585 | 1585 | $partial = $this->collSubscriptionsPartial && !$this->isNew(); |
| 1586 | - if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
| 1586 | + if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
| 1587 | 1587 | if ($this->isNew() && null === $this->collSubscriptions) { |
| 1588 | 1588 | // return empty collection |
| 1589 | 1589 | $this->initSubscriptions(); |
@@ -1721,7 +1721,7 @@ discard block |
||
| 1721 | 1721 | */ |
| 1722 | 1722 | protected function doAddSubscription(ChildSubscription $subscription) |
| 1723 | 1723 | { |
| 1724 | - $this->collSubscriptions[]= $subscription; |
|
| 1724 | + $this->collSubscriptions[] = $subscription; |
|
| 1725 | 1725 | $subscription->setUser($this); |
| 1726 | 1726 | } |
| 1727 | 1727 | |
@@ -1738,7 +1738,7 @@ discard block |
||
| 1738 | 1738 | $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions; |
| 1739 | 1739 | $this->subscriptionsScheduledForDeletion->clear(); |
| 1740 | 1740 | } |
| 1741 | - $this->subscriptionsScheduledForDeletion[]= $subscription; |
|
| 1741 | + $this->subscriptionsScheduledForDeletion[] = $subscription; |
|
| 1742 | 1742 | $subscription->setUser(null); |
| 1743 | 1743 | } |
| 1744 | 1744 | |