@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | private $schemaManager; |
20 | 20 | private $config; |
21 | 21 | |
22 | - public function __construct( AbstractSchemaManager $schemaManager, TermStoreConfig $config ) { |
|
22 | + public function __construct(AbstractSchemaManager $schemaManager, TermStoreConfig $config) { |
|
23 | 23 | $this->schemaManager = $schemaManager; |
24 | 24 | $this->config = $config; |
25 | 25 | } |
@@ -28,45 +28,45 @@ discard block |
||
28 | 28 | * @throws DBALException |
29 | 29 | */ |
30 | 30 | public function install() { |
31 | - $this->schemaManager->createTable( $this->newLabelTable() ); |
|
32 | - $this->schemaManager->createTable( $this->newAliasesTable() ); |
|
31 | + $this->schemaManager->createTable($this->newLabelTable()); |
|
32 | + $this->schemaManager->createTable($this->newAliasesTable()); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | private function newLabelTable() { |
36 | - $table = new Table( $this->config->getLabelTableName() ); |
|
36 | + $table = new Table($this->config->getLabelTableName()); |
|
37 | 37 | |
38 | - $table->addColumn( 'text', Type::STRING, array( 'length' => 255 ) ); |
|
39 | - $table->addColumn( 'text_lowercase', Type::STRING, array( 'length' => 255 ) ); |
|
40 | - $table->addColumn( 'language', Type::STRING, array( 'length' => 16 ) ); |
|
41 | - $table->addColumn( 'entity_id', Type::STRING, array( 'length' => 32 ) ); |
|
42 | - $table->addColumn( 'entity_type', Type::STRING, array( 'length' => 16 ) ); |
|
38 | + $table->addColumn('text', Type::STRING, array('length' => 255)); |
|
39 | + $table->addColumn('text_lowercase', Type::STRING, array('length' => 255)); |
|
40 | + $table->addColumn('language', Type::STRING, array('length' => 16)); |
|
41 | + $table->addColumn('entity_id', Type::STRING, array('length' => 32)); |
|
42 | + $table->addColumn('entity_type', Type::STRING, array('length' => 16)); |
|
43 | 43 | |
44 | - $table->addIndex( array( 'text_lowercase', 'language' ) ); |
|
45 | - $table->addIndex( array( 'entity_id', 'language' ) ); |
|
46 | - $table->addIndex( array( 'entity_type' ) ); |
|
44 | + $table->addIndex(array('text_lowercase', 'language')); |
|
45 | + $table->addIndex(array('entity_id', 'language')); |
|
46 | + $table->addIndex(array('entity_type')); |
|
47 | 47 | |
48 | 48 | return $table; |
49 | 49 | } |
50 | 50 | |
51 | 51 | private function newAliasesTable() { |
52 | - $table = new Table( $this->config->getAliasesTableName() ); |
|
52 | + $table = new Table($this->config->getAliasesTableName()); |
|
53 | 53 | |
54 | - $table->addColumn( 'text', Type::STRING, array( 'length' => 255 ) ); |
|
55 | - $table->addColumn( 'text_lowercase', Type::STRING, array( 'length' => 255 ) ); |
|
56 | - $table->addColumn( 'language', Type::STRING, array( 'length' => 16 ) ); |
|
57 | - $table->addColumn( 'entity_id', Type::STRING, array( 'length' => 32 ) ); |
|
58 | - $table->addColumn( 'entity_type', Type::STRING, array( 'length' => 16 ) ); |
|
54 | + $table->addColumn('text', Type::STRING, array('length' => 255)); |
|
55 | + $table->addColumn('text_lowercase', Type::STRING, array('length' => 255)); |
|
56 | + $table->addColumn('language', Type::STRING, array('length' => 16)); |
|
57 | + $table->addColumn('entity_id', Type::STRING, array('length' => 32)); |
|
58 | + $table->addColumn('entity_type', Type::STRING, array('length' => 16)); |
|
59 | 59 | |
60 | - $table->addIndex( array( 'text_lowercase', 'language' ) ); |
|
61 | - $table->addIndex( array( 'entity_id', 'language' ) ); |
|
62 | - $table->addIndex( array( 'entity_type' ) ); |
|
60 | + $table->addIndex(array('text_lowercase', 'language')); |
|
61 | + $table->addIndex(array('entity_id', 'language')); |
|
62 | + $table->addIndex(array('entity_type')); |
|
63 | 63 | |
64 | 64 | return $table; |
65 | 65 | } |
66 | 66 | |
67 | 67 | public function uninstall() { |
68 | - $this->schemaManager->dropTable( $this->config->getLabelTableName() ); |
|
69 | - $this->schemaManager->dropTable( $this->config->getAliasesTableName() ); |
|
68 | + $this->schemaManager->dropTable($this->config->getLabelTableName()); |
|
69 | + $this->schemaManager->dropTable($this->config->getAliasesTableName()); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | } |
73 | 73 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | private $connection; |
17 | 17 | private $config; |
18 | 18 | |
19 | - public function __construct( Connection $connection, TermStoreConfig $config ) { |
|
19 | + public function __construct(Connection $connection, TermStoreConfig $config) { |
|
20 | 20 | $this->connection = $connection; |
21 | 21 | $this->config = $config; |
22 | 22 | } |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | * @return EntityIdLookup |
33 | 33 | */ |
34 | 34 | public function newEntityIdLookup() { |
35 | - $labelTable = new TableQueryExecutor( $this->connection, $this->config->getLabelTableName() ); |
|
36 | - $aliasesTable = new TableQueryExecutor( $this->connection, $this->config->getAliasesTableName() ); |
|
35 | + $labelTable = new TableQueryExecutor($this->connection, $this->config->getLabelTableName()); |
|
36 | + $aliasesTable = new TableQueryExecutor($this->connection, $this->config->getAliasesTableName()); |
|
37 | 37 | |
38 | - return new IdLookup( $labelTable, $aliasesTable ); |
|
38 | + return new IdLookup($labelTable, $aliasesTable); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @return TermStoreWriter |
43 | 43 | */ |
44 | 44 | public function newTermStoreWriter() { |
45 | - return new TermStoreWriter( $this->connection, $this->config ); |
|
45 | + return new TermStoreWriter($this->connection, $this->config); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @return TermStore |
61 | 61 | */ |
62 | 62 | public function newTermStore() { |
63 | - return new TermStore( $this->connection, $this->config ); |
|
63 | + return new TermStore($this->connection, $this->config); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -20,6 +20,6 @@ |
||
20 | 20 | * @return string|null |
21 | 21 | * @throws TermStoreException |
22 | 22 | */ |
23 | - public function getLabelByIdAndLanguage( EntityId $id, $languageCode ); |
|
23 | + public function getLabelByIdAndLanguage(EntityId $id, $languageCode); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -28,15 +28,15 @@ |
||
28 | 28 | public function testWhenNoConnection_storeEntityFingerprintThrowsException() { |
29 | 29 | $writer = TestEnvironment::newInstanceWithoutTables()->getFactory()->newTermStoreWriter(); |
30 | 30 | |
31 | - $this->expectException( TermStoreException::class ); |
|
32 | - $writer->storeEntityFingerprint( new ItemId( 'Q1' ), new Fingerprint() ); |
|
31 | + $this->expectException(TermStoreException::class); |
|
32 | + $writer->storeEntityFingerprint(new ItemId('Q1'), new Fingerprint()); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function testWhenNoConnection_dropTermsForIdThrowsException() { |
36 | 36 | $writer = TestEnvironment::newInstanceWithoutTables()->getFactory()->newTermStoreWriter(); |
37 | 37 | |
38 | - $this->expectException( TermStoreException::class ); |
|
39 | - $writer->dropTermsForId( new ItemId( 'Q1' ) ); |
|
38 | + $this->expectException(TermStoreException::class); |
|
39 | + $writer->dropTermsForId(new ItemId('Q1')); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | } |
@@ -24,22 +24,22 @@ |
||
24 | 24 | private $store; |
25 | 25 | |
26 | 26 | public function setUp() { |
27 | - $connection = DriverManager::getConnection( array( |
|
27 | + $connection = DriverManager::getConnection(array( |
|
28 | 28 | 'driver' => 'pdo_sqlite', |
29 | 29 | 'memory' => true, |
30 | - ) ); |
|
30 | + )); |
|
31 | 31 | |
32 | - $this->store = new TermStore( $connection, new TermStoreConfig( '' ) ); |
|
32 | + $this->store = new TermStore($connection, new TermStoreConfig('')); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function testInsertWhenStoreNotInstalledCausesTermStoreException() { |
36 | - $id = new ItemId( 'Q1337' ); |
|
36 | + $id = new ItemId('Q1337'); |
|
37 | 37 | |
38 | 38 | $fingerprint = new Fingerprint(); |
39 | - $fingerprint->setLabel( 'en', 'EN label' ); |
|
39 | + $fingerprint->setLabel('en', 'EN label'); |
|
40 | 40 | |
41 | - $this->expectException( TermStoreException::class ); |
|
42 | - $this->store->storeEntityFingerprint( $id, $fingerprint ); |
|
41 | + $this->expectException(TermStoreException::class); |
|
42 | + $this->store->storeEntityFingerprint($id, $fingerprint); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | } |
@@ -27,30 +27,30 @@ |
||
27 | 27 | private $schemaManager; |
28 | 28 | |
29 | 29 | public function setUp() { |
30 | - $connection = DriverManager::getConnection( array( |
|
30 | + $connection = DriverManager::getConnection(array( |
|
31 | 31 | 'driver' => 'pdo_sqlite', |
32 | 32 | 'memory' => true, |
33 | - ) ); |
|
33 | + )); |
|
34 | 34 | |
35 | 35 | $this->schemaManager = $connection->getSchemaManager(); |
36 | - $this->storeInstaller = new TermStoreInstaller( $this->schemaManager, new TermStoreConfig( 'kittens_' ) ); |
|
36 | + $this->storeInstaller = new TermStoreInstaller($this->schemaManager, new TermStoreConfig('kittens_')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function testInstallationAndRemoval() { |
40 | 40 | $this->storeInstaller->install(); |
41 | 41 | |
42 | - $this->assertTrue( $this->schemaManager->tablesExist( 'kittens_labels' ) ); |
|
43 | - $this->assertTrue( $this->schemaManager->tablesExist( 'kittens_aliases' ) ); |
|
42 | + $this->assertTrue($this->schemaManager->tablesExist('kittens_labels')); |
|
43 | + $this->assertTrue($this->schemaManager->tablesExist('kittens_aliases')); |
|
44 | 44 | |
45 | 45 | $this->storeInstaller->uninstall(); |
46 | 46 | |
47 | - $this->assertFalse( $this->schemaManager->tablesExist( 'kittens_labels' ) ); |
|
48 | - $this->assertFalse( $this->schemaManager->tablesExist( 'kittens_aliases' ) ); |
|
47 | + $this->assertFalse($this->schemaManager->tablesExist('kittens_labels')); |
|
48 | + $this->assertFalse($this->schemaManager->tablesExist('kittens_aliases')); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function testStoresPage() { |
52 | 52 | $this->storeInstaller->install(); |
53 | - $this->assertTrue( true ); |
|
53 | + $this->assertTrue(true); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | } |