@@ -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 | } |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | public function newEntityIdLookup(): EntityIdLookup { |
32 | - $labelTable = new TableQueryExecutor( $this->connection, $this->config->getLabelTableName() ); |
|
33 | - $aliasesTable = new TableQueryExecutor( $this->connection, $this->config->getAliasesTableName() ); |
|
32 | + $labelTable = new TableQueryExecutor($this->connection, $this->config->getLabelTableName()); |
|
33 | + $aliasesTable = new TableQueryExecutor($this->connection, $this->config->getAliasesTableName()); |
|
34 | 34 | |
35 | - return new IdLookup( $labelTable, $aliasesTable ); |
|
35 | + return new IdLookup($labelTable, $aliasesTable); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function newTermStoreWriter(): TermStoreWriter { |
39 | - return new TermStoreWriter( $this->connection, $this->config ); |
|
39 | + return new TermStoreWriter($this->connection, $this->config); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function newLabelLookup(): LabelLookup { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * Work with a more segregated interface (TermStoreWriter, EntityIdLookup, LabelLookup) if you can. |
48 | 48 | */ |
49 | 49 | public function newTermStore(): TermStore { |
50 | - return new TermStore( $this->connection, $this->config ); |
|
50 | + return new TermStore($this->connection, $this->config); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | } |
54 | 54 | \ 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, string $languageCode ): ?string; |
|
23 | + public function getLabelByIdAndLanguage(EntityId $id, string $languageCode): ?string; |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @return string|null |
21 | 21 | * @throws TermStoreException |
22 | 22 | */ |
23 | - public function getIdByLabel( string $labelLanguageCode, string $labelText ): ?string; |
|
23 | + public function getIdByLabel(string $labelLanguageCode, string $labelText): ?string; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Returns the first matching item id. Case insensitive. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string|null |
32 | 32 | * @throws TermStoreException |
33 | 33 | */ |
34 | - public function getItemIdByLabel( string $labelLanguageCode, string $labelText ): ?string; |
|
34 | + public function getItemIdByLabel(string $labelLanguageCode, string $labelText): ?string; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Returns the first matching property id. Case insensitive. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return string|null |
43 | 43 | * @throws TermStoreException |
44 | 44 | */ |
45 | - public function getPropertyIdByLabel( string $labelLanguageCode, string $labelText ): ?string; |
|
45 | + public function getPropertyIdByLabel(string $labelLanguageCode, string $labelText): ?string; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Returns the first matching entity id. Case insensitive. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return string|null |
54 | 54 | * @throws TermStoreException |
55 | 55 | */ |
56 | - public function getIdByText( string $languageCode, string $termText ): ?string; |
|
56 | + public function getIdByText(string $languageCode, string $termText): ?string; |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * Returns the first matching item id. Case insensitive. |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return string|null |
65 | 65 | * @throws TermStoreException |
66 | 66 | */ |
67 | - public function getItemIdByText( string $languageCode, string $termText ): ?string; |
|
67 | + public function getItemIdByText(string $languageCode, string $termText): ?string; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Returns the first matching property id. Case insensitive. |
@@ -75,6 +75,6 @@ discard block |
||
75 | 75 | * @return string|null |
76 | 76 | * @throws TermStoreException |
77 | 77 | */ |
78 | - public function getPropertyIdByText( string $languageCode, string $termText ): ?string; |
|
78 | + public function getPropertyIdByText(string $languageCode, string $termText): ?string; |
|
79 | 79 | |
80 | 80 | } |
81 | 81 | \ No newline at end of file |
@@ -13,16 +13,16 @@ |
||
13 | 13 | |
14 | 14 | private $prefix; |
15 | 15 | |
16 | - public function __construct( string $tablePrefix = '' ) { |
|
16 | + public function __construct(string $tablePrefix = '') { |
|
17 | 17 | $this->prefix = $tablePrefix; |
18 | 18 | } |
19 | 19 | |
20 | 20 | public function getLabelTableName(): string { |
21 | - return $this->prefix . 'labels'; |
|
21 | + return $this->prefix.'labels'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function getAliasesTableName(): string { |
25 | - return $this->prefix . 'aliases'; |
|
25 | + return $this->prefix.'aliases'; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | private $connection; |
22 | 22 | private $config; |
23 | 23 | |
24 | - public function __construct( Connection $connection, TermStoreConfig $config ) { |
|
24 | + public function __construct(Connection $connection, TermStoreConfig $config) { |
|
25 | 25 | $this->connection = $connection; |
26 | 26 | $this->config = $config; |
27 | 27 | } |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @throws TermStoreException |
34 | 34 | */ |
35 | - public function storeEntityFingerprint( EntityId $id, Fingerprint $fingerprint ): void { |
|
35 | + public function storeEntityFingerprint(EntityId $id, Fingerprint $fingerprint): void { |
|
36 | 36 | $this->connection->beginTransaction(); |
37 | 37 | |
38 | - $this->dropTermsForId( $id ); |
|
38 | + $this->dropTermsForId($id); |
|
39 | 39 | |
40 | 40 | try { |
41 | - $this->storeFingerprintParts( $id, $fingerprint ); |
|
41 | + $this->storeFingerprintParts($id, $fingerprint); |
|
42 | 42 | } |
43 | - catch ( DBALException $ex ) { |
|
43 | + catch (DBALException $ex) { |
|
44 | 44 | $this->connection->rollBack(); |
45 | - throw new TermStoreException( $ex->getMessage(), $ex ); |
|
45 | + throw new TermStoreException($ex->getMessage(), $ex); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $this->connection->commit(); |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * @throws DBALException |
53 | 53 | */ |
54 | - private function storeFingerprintParts( EntityId $id, Fingerprint $fingerprint ) { |
|
54 | + private function storeFingerprintParts(EntityId $id, Fingerprint $fingerprint) { |
|
55 | 55 | /** |
56 | 56 | * @var Term $label |
57 | 57 | */ |
58 | - foreach ( $fingerprint->getLabels() as $label ) { |
|
59 | - $this->storeLabel( $label->getLanguageCode(), $label->getText(), $id ); |
|
58 | + foreach ($fingerprint->getLabels() as $label) { |
|
59 | + $this->storeLabel($label->getLanguageCode(), $label->getText(), $id); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @var AliasGroup $aliasGroup |
64 | 64 | */ |
65 | - foreach ( $fingerprint->getAliasGroups() as $aliasGroup ) { |
|
66 | - $this->storeAliases( $aliasGroup, $id ); |
|
65 | + foreach ($fingerprint->getAliasGroups() as $aliasGroup) { |
|
66 | + $this->storeAliases($aliasGroup, $id); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @throws TermStoreException |
74 | 74 | */ |
75 | - public function dropTermsForId( EntityId $id ): void { |
|
75 | + public function dropTermsForId(EntityId $id): void { |
|
76 | 76 | try { |
77 | 77 | $this->connection->delete( |
78 | 78 | $this->config->getLabelTableName(), |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | [ 'entity_id' => $id->getSerialization() ] |
85 | 85 | ); |
86 | 86 | } |
87 | - catch ( DBALException $ex ) { |
|
88 | - throw new TermStoreException( $ex->getMessage(), $ex ); |
|
87 | + catch (DBALException $ex) { |
|
88 | + throw new TermStoreException($ex->getMessage(), $ex); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | 93 | * @throws DBALException |
94 | 94 | */ |
95 | - private function storeLabel( string $languageCode, string $text, EntityId $id ) { |
|
95 | + private function storeLabel(string $languageCode, string $text, EntityId $id) { |
|
96 | 96 | $this->connection->insert( |
97 | 97 | $this->config->getLabelTableName(), |
98 | 98 | [ |
99 | 99 | 'text' => $text, |
100 | - 'text_lowercase' => strtolower( $text ), |
|
100 | + 'text_lowercase' => strtolower($text), |
|
101 | 101 | 'language' => $languageCode, |
102 | 102 | 'entity_id' => $id->getSerialization(), |
103 | 103 | 'entity_type' => $id->getEntityType() |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * @throws DBALException |
110 | 110 | */ |
111 | - private function storeAliases( AliasGroup $aliasGroup, EntityId $id ) { |
|
112 | - foreach ( $aliasGroup->getAliases() as $alias ) { |
|
111 | + private function storeAliases(AliasGroup $aliasGroup, EntityId $id) { |
|
112 | + foreach ($aliasGroup->getAliases() as $alias) { |
|
113 | 113 | $this->connection->insert( |
114 | 114 | $this->config->getAliasesTableName(), |
115 | 115 | [ |
116 | 116 | 'text' => $alias, |
117 | - 'text_lowercase' => strtolower( $alias ), |
|
117 | + 'text_lowercase' => strtolower($alias), |
|
118 | 118 | 'language' => $aliasGroup->getLanguageCode(), |
119 | 119 | 'entity_id' => $id->getSerialization(), |
120 | 120 | 'entity_type' => $id->getEntityType() |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | private $labelTable; |
16 | 16 | private $aliasesTable; |
17 | 17 | |
18 | - public function __construct( TableQueryExecutor $labelTable, TableQueryExecutor $aliasesTable ) { |
|
18 | + public function __construct(TableQueryExecutor $labelTable, TableQueryExecutor $aliasesTable) { |
|
19 | 19 | $this->labelTable = $labelTable; |
20 | 20 | $this->aliasesTable = $aliasesTable; |
21 | 21 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @throws TermStoreException |
27 | 27 | */ |
28 | - public function getIdByLabel( string $labelLanguageCode, string $labelText ): ?string { |
|
29 | - return $this->getEntityIdByLabel( $labelLanguageCode, $labelText ); |
|
28 | + public function getIdByLabel(string $labelLanguageCode, string $labelText): ?string { |
|
29 | + return $this->getEntityIdByLabel($labelLanguageCode, $labelText); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @throws TermStoreException |
36 | 36 | */ |
37 | - public function getItemIdByLabel( string $labelLanguageCode, string $labelText ): ?string { |
|
38 | - return $this->getEntityIdByLabel( $labelLanguageCode, $labelText, 'item' ); |
|
37 | + public function getItemIdByLabel(string $labelLanguageCode, string $labelText): ?string { |
|
38 | + return $this->getEntityIdByLabel($labelLanguageCode, $labelText, 'item'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @throws TermStoreException |
45 | 45 | */ |
46 | - public function getPropertyIdByLabel( string $labelLanguageCode, string $labelText ): ?string { |
|
47 | - return $this->getEntityIdByLabel( $labelLanguageCode, $labelText, 'property' ); |
|
46 | + public function getPropertyIdByLabel(string $labelLanguageCode, string $labelText): ?string { |
|
47 | + return $this->getEntityIdByLabel($labelLanguageCode, $labelText, 'property'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @return string|null |
56 | 56 | * @throws TermStoreException |
57 | 57 | */ |
58 | - private function getEntityIdByLabel( $labelLanguageCode, $labelText, $entityTypeFilter = null ) { |
|
58 | + private function getEntityIdByLabel($labelLanguageCode, $labelText, $entityTypeFilter = null) { |
|
59 | 59 | $conditions = [ |
60 | - 'text_lowercase' => strtolower( $labelText ), |
|
60 | + 'text_lowercase' => strtolower($labelText), |
|
61 | 61 | 'language' => $labelLanguageCode, |
62 | 62 | ]; |
63 | 63 | |
64 | - if ( $entityTypeFilter !== null ) { |
|
65 | - $conditions['entity_type'] = $entityTypeFilter; |
|
64 | + if ($entityTypeFilter !== null) { |
|
65 | + $conditions[ 'entity_type' ] = $entityTypeFilter; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | try { |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | $conditions |
72 | 72 | ); |
73 | 73 | } |
74 | - catch ( DBALException $ex ) { |
|
75 | - throw new TermStoreException( $ex->getMessage(), $ex ); |
|
74 | + catch (DBALException $ex) { |
|
75 | + throw new TermStoreException($ex->getMessage(), $ex); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @throws TermStoreException |
83 | 83 | */ |
84 | - public function getIdByText( string $languageCode, string $termText ): ?string { |
|
85 | - return $this->getEntityIdByText( $languageCode, $termText ); |
|
84 | + public function getIdByText(string $languageCode, string $termText): ?string { |
|
85 | + return $this->getEntityIdByText($languageCode, $termText); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @throws TermStoreException |
92 | 92 | */ |
93 | - public function getItemIdByText( string $languageCode, string $termText ): ?string { |
|
94 | - return $this->getEntityIdByText( $languageCode, $termText, 'item' ); |
|
93 | + public function getItemIdByText(string $languageCode, string $termText): ?string { |
|
94 | + return $this->getEntityIdByText($languageCode, $termText, 'item'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @throws TermStoreException |
101 | 101 | */ |
102 | - public function getPropertyIdByText( string $languageCode, string $termText ): ?string { |
|
103 | - return $this->getEntityIdByText( $languageCode, $termText, 'property' ); |
|
102 | + public function getPropertyIdByText(string $languageCode, string $termText): ?string { |
|
103 | + return $this->getEntityIdByText($languageCode, $termText, 'property'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | * @return string|null |
112 | 112 | * @throws TermStoreException |
113 | 113 | */ |
114 | - private function getEntityIdByText( string $languageCode, string $termText, $entityTypeFilter = null ) { |
|
115 | - $labelMatch = $this->getEntityIdByLabel( $languageCode, $termText, $entityTypeFilter ); |
|
114 | + private function getEntityIdByText(string $languageCode, string $termText, $entityTypeFilter = null) { |
|
115 | + $labelMatch = $this->getEntityIdByLabel($languageCode, $termText, $entityTypeFilter); |
|
116 | 116 | |
117 | - if ( $labelMatch !== null ) { |
|
117 | + if ($labelMatch !== null) { |
|
118 | 118 | return $labelMatch; |
119 | 119 | } |
120 | 120 | |
121 | - return $this->getIdByAlias( $languageCode, $termText, $entityTypeFilter ); |
|
121 | + return $this->getIdByAlias($languageCode, $termText, $entityTypeFilter); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | * @return string|null |
130 | 130 | * @throws TermStoreException |
131 | 131 | */ |
132 | - private function getIdByAlias( string $aliasLanguageCode, string $aliasText, $entityTypeFilter = null ) { |
|
132 | + private function getIdByAlias(string $aliasLanguageCode, string $aliasText, $entityTypeFilter = null) { |
|
133 | 133 | $conditions = [ |
134 | - 'text_lowercase' => strtolower( $aliasText ), |
|
134 | + 'text_lowercase' => strtolower($aliasText), |
|
135 | 135 | 'language' => $aliasLanguageCode |
136 | 136 | ]; |
137 | 137 | |
138 | - if ( $entityTypeFilter !== null ) { |
|
139 | - $conditions['entity_type'] = $entityTypeFilter; |
|
138 | + if ($entityTypeFilter !== null) { |
|
139 | + $conditions[ 'entity_type' ] = $entityTypeFilter; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | try { |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | $conditions |
146 | 146 | ); |
147 | 147 | } |
148 | - catch ( DBALException $ex ) { |
|
149 | - throw new TermStoreException( $ex->getMessage(), $ex ); |
|
148 | + catch (DBALException $ex) { |
|
149 | + throw new TermStoreException($ex->getMessage(), $ex); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 |
@@ -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,38 +28,38 @@ discard block |
||
28 | 28 | * @throws DBALException |
29 | 29 | */ |
30 | 30 | public function install(): void { |
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(): Table { |
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(): Table { |
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 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @throws DBALException |
69 | 69 | */ |
70 | 70 | public function uninstall(): void { |
71 | - $this->schemaManager->dropTable( $this->config->getLabelTableName() ); |
|
72 | - $this->schemaManager->dropTable( $this->config->getAliasesTableName() ); |
|
71 | + $this->schemaManager->dropTable($this->config->getLabelTableName()); |
|
72 | + $this->schemaManager->dropTable($this->config->getAliasesTableName()); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | } |
76 | 76 | \ No newline at end of file |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | private $labelTable; |
23 | 23 | private $aliasesTable; |
24 | 24 | |
25 | - public function __construct( Connection $connection, TermStoreConfig $config ) { |
|
26 | - $this->labelTable = new TableQueryExecutor( $connection, $config->getLabelTableName() ); |
|
27 | - $this->aliasesTable = new TableQueryExecutor( $connection, $config->getAliasesTableName() ); |
|
25 | + public function __construct(Connection $connection, TermStoreConfig $config) { |
|
26 | + $this->labelTable = new TableQueryExecutor($connection, $config->getLabelTableName()); |
|
27 | + $this->aliasesTable = new TableQueryExecutor($connection, $config->getAliasesTableName()); |
|
28 | 28 | |
29 | - $this->storeWriter = new TermStoreWriter( $connection, $config ); |
|
30 | - $this->idLookup = new IdLookup( $this->labelTable, $this->aliasesTable ); |
|
29 | + $this->storeWriter = new TermStoreWriter($connection, $config); |
|
30 | + $this->idLookup = new IdLookup($this->labelTable, $this->aliasesTable); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @throws TermStoreException |
38 | 38 | */ |
39 | - public function storeEntityFingerprint( EntityId $id, Fingerprint $fingerprint ) { |
|
40 | - $this->storeWriter->storeEntityFingerprint( $id, $fingerprint ); |
|
39 | + public function storeEntityFingerprint(EntityId $id, Fingerprint $fingerprint) { |
|
40 | + $this->storeWriter->storeEntityFingerprint($id, $fingerprint); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @throws TermStoreException |
47 | 47 | */ |
48 | - public function dropTermsForId( EntityId $id ) { |
|
49 | - $this->storeWriter->dropTermsForId( $id ); |
|
48 | + public function dropTermsForId(EntityId $id) { |
|
49 | + $this->storeWriter->dropTermsForId($id); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @throws TermStoreException |
54 | 54 | */ |
55 | - public function getLabelByIdAndLanguage( EntityId $id, string $languageCode ): ?string { |
|
55 | + public function getLabelByIdAndLanguage(EntityId $id, string $languageCode): ?string { |
|
56 | 56 | try { |
57 | 57 | return $this->labelTable->selectOneField( |
58 | 58 | 'text', |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | ] |
63 | 63 | ); |
64 | 64 | } |
65 | - catch ( DBALException $ex ) { |
|
66 | - throw new TermStoreException( $ex->getMessage(), $ex ); |
|
65 | + catch (DBALException $ex) { |
|
66 | + throw new TermStoreException($ex->getMessage(), $ex); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @return string[] |
75 | 75 | * @throws TermStoreException |
76 | 76 | */ |
77 | - public function getAliasesByIdAndLanguage( EntityId $id, string $languageCode ): array { |
|
77 | + public function getAliasesByIdAndLanguage(EntityId $id, string $languageCode): array { |
|
78 | 78 | try { |
79 | 79 | return $this->aliasesTable->selectField( |
80 | 80 | 'text', |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | ] |
85 | 85 | ); |
86 | 86 | } |
87 | - catch ( DBALException $ex ) { |
|
88 | - throw new TermStoreException( $ex->getMessage(), $ex ); |
|
87 | + catch (DBALException $ex) { |
|
88 | + throw new TermStoreException($ex->getMessage(), $ex); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @throws TermStoreException |
96 | 96 | */ |
97 | - public function getIdByLabel( string $labelLanguageCode, string $labelText ): ?string { |
|
98 | - return $this->idLookup->getIdByLabel( $labelLanguageCode, $labelText ); |
|
97 | + public function getIdByLabel(string $labelLanguageCode, string $labelText): ?string { |
|
98 | + return $this->idLookup->getIdByLabel($labelLanguageCode, $labelText); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @throws TermStoreException |
105 | 105 | */ |
106 | - public function getItemIdByLabel( string $labelLanguageCode, string $labelText ): ?string { |
|
107 | - return $this->idLookup->getItemIdByLabel( $labelLanguageCode, $labelText ); |
|
106 | + public function getItemIdByLabel(string $labelLanguageCode, string $labelText): ?string { |
|
107 | + return $this->idLookup->getItemIdByLabel($labelLanguageCode, $labelText); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @throws TermStoreException |
114 | 114 | */ |
115 | - public function getPropertyIdByLabel( string $labelLanguageCode, string $labelText ): ?string { |
|
116 | - return $this->idLookup->getPropertyIdByLabel( $labelLanguageCode, $labelText ); |
|
115 | + public function getPropertyIdByLabel(string $labelLanguageCode, string $labelText): ?string { |
|
116 | + return $this->idLookup->getPropertyIdByLabel($labelLanguageCode, $labelText); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @throws TermStoreException |
123 | 123 | */ |
124 | - public function getIdByText( string $languageCode, string $termText ): ?string { |
|
125 | - return $this->idLookup->getIdByText( $languageCode, $termText ); |
|
124 | + public function getIdByText(string $languageCode, string $termText): ?string { |
|
125 | + return $this->idLookup->getIdByText($languageCode, $termText); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @throws TermStoreException |
132 | 132 | */ |
133 | - public function getItemIdByText( string $languageCode, string $termText ): ?string { |
|
134 | - return $this->idLookup->getItemIdByText( $languageCode, $termText ); |
|
133 | + public function getItemIdByText(string $languageCode, string $termText): ?string { |
|
134 | + return $this->idLookup->getItemIdByText($languageCode, $termText); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @throws TermStoreException |
141 | 141 | */ |
142 | - public function getPropertyIdByText( string $languageCode, string $termText ): ?string { |
|
143 | - return $this->idLookup->getPropertyIdByText( $languageCode, $termText ); |
|
142 | + public function getPropertyIdByText(string $languageCode, string $termText): ?string { |
|
143 | + return $this->idLookup->getPropertyIdByText($languageCode, $termText); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | } |
@@ -11,8 +11,8 @@ |
||
11 | 11 | */ |
12 | 12 | class TermStoreException extends \RuntimeException { |
13 | 13 | |
14 | - public function __construct( string $message, \Exception $previous = null ) { |
|
15 | - parent::__construct( $message, 0, $previous ); |
|
14 | + public function __construct(string $message, \Exception $previous = null) { |
|
15 | + parent::__construct($message, 0, $previous); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | } |
19 | 19 | \ No newline at end of file |