@@ -17,7 +17,7 @@ |
||
| 17 | 17 | /** |
| 18 | 18 | * {@inheritdoc} |
| 19 | 19 | */ |
| 20 | - public function load(array $configs, ContainerBuilder $container) { |
|
| 20 | + public function load(array $configs, ContainerBuilder $container){ |
|
| 21 | 21 | $configuration = new Configuration(); |
| 22 | 22 | $config = $this->processConfiguration($configuration, $configs); |
| 23 | 23 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * {@inheritdoc} |
| 17 | 17 | */ |
| 18 | - public function getConfigTreeBuilder() { |
|
| 18 | + public function getConfigTreeBuilder(){ |
|
| 19 | 19 | $treeBuilder = new TreeBuilder(); |
| 20 | 20 | $rootNode = $treeBuilder->root('stinger_soft_platform'); |
| 21 | 21 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | class TestCase extends \PHPUnit_Framework_TestCase { |
| 24 | 24 | |
| 25 | 25 | |
| 26 | - public function createContainer() { |
|
| 26 | + public function createContainer(){ |
|
| 27 | 27 | $container = new ContainerBuilder(new ParameterBag(array( |
| 28 | 28 | 'kernel.debug' => false, |
| 29 | 29 | // 'kernel.bundles' => array('YamlBundle' => 'Fixtures\Bundles\YamlBundle\YamlBundle'), |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | class GroupTest extends TestCase { |
| 15 | 15 | |
| 16 | - public function testBasicGroupStuff() { |
|
| 16 | + public function testBasicGroupStuff(){ |
|
| 17 | 17 | $group = new Group('mygroup'); |
| 18 | 18 | |
| 19 | 19 | $this->assertEquals('mygroup', $group->getName()); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $this->assertEmpty($group->getRoles()); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function testGroupRoles() { |
|
| 24 | + public function testGroupRoles(){ |
|
| 25 | 25 | $group = new Group('mygroup', array('1', '2')); |
| 26 | 26 | $this->assertNotEmpty($group->getRoles()); |
| 27 | 27 | $this->assertContains('1', $group->getRoles()); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->assertEmpty($group->getRoles()); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public function testGroupUsers() { |
|
| 54 | + public function testGroupUsers(){ |
|
| 55 | 55 | $group = new Group('mygroup'); |
| 56 | 56 | |
| 57 | 57 | $this->assertEmpty($group->getUsers()); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | class UserTest extends TestCase { |
| 16 | 16 | |
| 17 | - public function testBasicUserStuff() { |
|
| 17 | + public function testBasicUserStuff(){ |
|
| 18 | 18 | $user = new User(); |
| 19 | 19 | |
| 20 | 20 | $this->assertEquals('', $user->getFirstname()); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - public function getFirstname() { |
|
| 45 | + public function getFirstname(){ |
|
| 46 | 46 | return $this->firstname; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return $this |
| 53 | 53 | */ |
| 54 | - public function setFirstname($firstname) { |
|
| 54 | + public function setFirstname($firstname){ |
|
| 55 | 55 | $this->firstname = $firstname; |
| 56 | 56 | |
| 57 | 57 | return $this; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | - public function getSurname() { |
|
| 63 | + public function getSurname(){ |
|
| 64 | 64 | return $this->surname; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return $this |
| 71 | 71 | */ |
| 72 | - public function setSurname($surname) { |
|
| 72 | + public function setSurname($surname){ |
|
| 73 | 73 | $this->surname = $surname; |
| 74 | 74 | |
| 75 | 75 | return $this; |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return string |
| 82 | 82 | */ |
| 83 | - public function getRealName() { |
|
| 84 | - if($this->firstname || $this->surname) { |
|
| 83 | + public function getRealName(){ |
|
| 84 | + if($this->firstname || $this->surname){ |
|
| 85 | 85 | return $this->getFirstname() . ' ' . $this->getSurname(); |
| 86 | 86 | } |
| 87 | 87 | return null; |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return string - "Username" ("Firstname Surname") |
| 93 | 93 | */ |
| 94 | - public function getUsernameAndRealName() { |
|
| 94 | + public function getUsernameAndRealName(){ |
|
| 95 | 95 | return $this->getUsername() . ' (' . $this->getRealName() . ')'; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * @return string "Surname, Firstname"|"Surname" |
| 100 | 100 | */ |
| 101 | - public function getReversedRealName() { |
|
| 102 | - if($this->getFirstname()) { |
|
| 101 | + public function getReversedRealName(){ |
|
| 102 | + if($this->getFirstname()){ |
|
| 103 | 103 | return $this->getSurname() . ', ' . $this->getFirstname(); |
| 104 | - } else { |
|
| 104 | + } else{ |
|
| 105 | 105 | return $this->getSurname(); |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * @return string "Firstname Surname"|"Username" |
| 111 | 111 | */ |
| 112 | - public function __toString() { |
|
| 112 | + public function __toString(){ |
|
| 113 | 113 | return $this->getRealName() != null ? $this->getRealName() : $this->getUsername(); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | \ No newline at end of file |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | const SERVICE_ID = 'stinger_soft_platform.doctrine.table_prefix'; |
| 28 | 28 | |
| 29 | - public function getSubscribedEvents() { |
|
| 29 | + public function getSubscribedEvents(){ |
|
| 30 | 30 | return array( |
| 31 | 31 | 'loadClassMetadata' |
| 32 | 32 | ); |
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param LoadClassMetadataEventArgs $args |
| 38 | 38 | */ |
| 39 | - public function loadClassMetadata(LoadClassMetadataEventArgs $args) { |
|
| 39 | + public function loadClassMetadata(LoadClassMetadataEventArgs $args){ |
|
| 40 | 40 | $classMetadata = $args->getClassMetadata(); |
| 41 | 41 | |
| 42 | 42 | // Do not re-apply the prefix in an inheritance hierarchy. |
| 43 | - if($classMetadata->isInheritanceTypeSingleTable() && !$classMetadata->isRootEntity()) { |
|
| 43 | + if($classMetadata->isInheritanceTypeSingleTable() && !$classMetadata->isRootEntity()){ |
|
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $prefix = $classMetadata->namespace; |
| 48 | - if(!preg_match('/([^\\\\]+)Bundle/i', $classMetadata->namespace, $prefix)) { |
|
| 48 | + if(!preg_match('/([^\\\\]+)Bundle/i', $classMetadata->namespace, $prefix)){ |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | // Can this happen?? |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | 'name' => $prefix . $classMetadata->getTableName() |
| 59 | 59 | )); |
| 60 | 60 | |
| 61 | - foreach($classMetadata->getAssociationMappings() as $fieldName => $mapping) { |
|
| 62 | - if($mapping['type'] == ClassMetadataInfo::MANY_TO_MANY && isset($classMetadata->associationMappings[$fieldName]['joinTable']['name'])) { |
|
| 63 | - if(isset($classMetadata->associationMappings[$fieldName]['joinTable']['prefixed']) && $classMetadata->associationMappings[$fieldName]['joinTable']['prefixed']) { |
|
| 61 | + foreach($classMetadata->getAssociationMappings() as $fieldName => $mapping){ |
|
| 62 | + if($mapping['type'] == ClassMetadataInfo::MANY_TO_MANY && isset($classMetadata->associationMappings[$fieldName]['joinTable']['name'])){ |
|
| 63 | + if(isset($classMetadata->associationMappings[$fieldName]['joinTable']['prefixed']) && $classMetadata->associationMappings[$fieldName]['joinTable']['prefixed']){ |
|
| 64 | 64 | continue; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -38,19 +38,19 @@ discard block |
||
| 38 | 38 | * $name |
| 39 | 39 | * @param array $roles |
| 40 | 40 | */ |
| 41 | - public function __construct($name, $roles = array()) { |
|
| 41 | + public function __construct($name, $roles = array()){ |
|
| 42 | 42 | $this->users = new ArrayCollection(); |
| 43 | 43 | parent::__construct($name, $roles); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function addRoles(array $roles) { |
|
| 47 | - foreach($roles as $role) { |
|
| 46 | + public function addRoles(array $roles){ |
|
| 47 | + foreach($roles as $role){ |
|
| 48 | 48 | $this->addRole($role); |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function removeRoles(array $roles) { |
|
| 53 | - foreach($roles as $role) { |
|
| 52 | + public function removeRoles(array $roles){ |
|
| 53 | + foreach($roles as $role){ |
|
| 54 | 54 | $this->removeRole($role); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return Group |
| 64 | 64 | */ |
| 65 | - public function addUser(User $user) { |
|
| 65 | + public function addUser(User $user){ |
|
| 66 | 66 | $this->users[] = $user; |
| 67 | 67 | |
| 68 | 68 | return $this; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @param User $user |
| 75 | 75 | */ |
| 76 | - public function removeUser(User $user) { |
|
| 76 | + public function removeUser(User $user){ |
|
| 77 | 77 | $this->users->removeElement($user); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return \Doctrine\Common\Collections\Collection |
| 84 | 84 | */ |
| 85 | - public function getUsers() { |
|
| 85 | + public function getUsers(){ |
|
| 86 | 86 | return $this->users; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function getUsersCount() { |
|
| 89 | + public function getUsersCount(){ |
|
| 90 | 90 | return $this->users->count(); |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | \ No newline at end of file |
@@ -71,21 +71,21 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected $prefixService; |
| 73 | 73 | |
| 74 | - public function setUp() { |
|
| 74 | + public function setUp(){ |
|
| 75 | 75 | $this->prefixService = $this->createContainer()->get(TablePrefixService::SERVICE_ID); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function testService() { |
|
| 78 | + public function testService(){ |
|
| 79 | 79 | $this->assertInstanceOf('StingerSoft\PlatformBundle\Service\Doctrine\TablePrefixService', $this->prefixService); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function testSubscribedEvents() { |
|
| 82 | + public function testSubscribedEvents(){ |
|
| 83 | 83 | $this->assertArraySubset(array( |
| 84 | 84 | 'loadClassMetadata' |
| 85 | 85 | ), $this->prefixService->getSubscribedEvents()); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function testSingleInheritanceWithoutRoot() { |
|
| 88 | + public function testSingleInheritanceWithoutRoot(){ |
|
| 89 | 89 | $cm = $this->mockEventArgs(); |
| 90 | 90 | $cm->method('isInheritanceTypeSingleTable')->will($this->returnValue(true)); |
| 91 | 91 | $cm->method('isRootEntity')->will($this->returnValue(false)); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->assertEquals($cm->associationMappings, self::$assocMappingBefore); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function testloadClassMetadata() { |
|
| 99 | + public function testloadClassMetadata(){ |
|
| 100 | 100 | $cm = $this->mockEventArgs(); |
| 101 | 101 | $cm->method('isInheritanceTypeSingleTable')->will($this->returnValue(true)); |
| 102 | 102 | $cm->method('isRootEntity')->will($this->returnValue(true)); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $this->assertEquals($cm->associationMappings, self::$assocMappingAfter); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function testInvalidNamespace() { |
|
| 110 | + public function testInvalidNamespace(){ |
|
| 111 | 111 | $cm = $this->mockEventArgs(); |
| 112 | 112 | $cm->method('isInheritanceTypeSingleTable')->will($this->returnValue(true)); |
| 113 | 113 | $cm->method('isRootEntity')->will($this->returnValue(true)); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $this->assertEquals($cm->associationMappings, self::$assocMappingBefore); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - protected function mockEventArgs() { |
|
| 122 | + protected function mockEventArgs(){ |
|
| 123 | 123 | $cm = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->setConstructorArgs(array( |
| 124 | 124 | 'StingerSoftPlatform:User' |
| 125 | 125 | ))->getMock(); |