@@ -5,13 +5,13 @@ |
||
5 | 5 | class SwpLogger |
6 | 6 | { |
7 | 7 | |
8 | - public static function log(string $message,bool $echo = false, string $fileName = 'swp.log') |
|
8 | + public static function log(string $message, bool $echo = false, string $fileName = 'swp.log') |
|
9 | 9 | { |
10 | 10 | $trace = debug_backtrace()[1]; |
11 | - $message = '[' . date('Y-m-d H:i:s') . '][' . $trace['class'] . '::' . $trace['function'] . '] ' . $message . PHP_EOL; |
|
11 | + $message = '['.date('Y-m-d H:i:s').']['.$trace['class'].'::'.$trace['function'].'] '.$message.PHP_EOL; |
|
12 | 12 | |
13 | 13 | if (!empty($fileName)) { |
14 | - file_put_contents('/tmp/' . $fileName, $message, FILE_APPEND); |
|
14 | + file_put_contents('/tmp/'.$fileName, $message, FILE_APPEND); |
|
15 | 15 | } |
16 | 16 | if ($echo) { |
17 | 17 | echo $message; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'secret' => $token, |
98 | 98 | ]; |
99 | 99 | |
100 | - $response = $client->request('POST', $url, [ |
|
100 | + $response = $client->request('POST', $url, [ |
|
101 | 101 | 'headers' => $headers, |
102 | 102 | 'json' => $data, |
103 | 103 | 'query' => $queryParams |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | ] |
117 | 117 | ]; |
118 | 118 | |
119 | - file_put_contents('/tmp/cache_invalidation.json', json_encode($result) . PHP_EOL, FILE_APPEND); |
|
119 | + file_put_contents('/tmp/cache_invalidation.json', json_encode($result).PHP_EOL, FILE_APPEND); |
|
120 | 120 | } catch (\Throwable $e) { |
121 | - file_put_contents('/tmp/cache_invalidation_errors.json', $e->getMessage() . PHP_EOL, FILE_APPEND); |
|
121 | + file_put_contents('/tmp/cache_invalidation_errors.json', $e->getMessage().PHP_EOL, FILE_APPEND); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 |
@@ -84,7 +84,7 @@ |
||
84 | 84 | $subject = $metadata['subject'] ?? []; |
85 | 85 | foreach ($subject as $key => $item) { |
86 | 86 | if (isset($item['scheme']) && $item['scheme'] == 'urgency') { |
87 | - $filters['metadata']['subject'][$key]['code'] = (string)$item['code']; |
|
87 | + $filters['metadata']['subject'][$key]['code'] = (string) $item['code']; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | $criteria = new Criteria($filters); |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | ), |
145 | 145 | Events::PACKAGE_PRE_OPTIONS); |
146 | 146 | } |
147 | - $this->eventDispatcher->dispatch( new GenericEvent($existingPackage, ['eventName' => Events::PACKAGE_PRE_UPDATE]), Events::PACKAGE_PRE_UPDATE); |
|
147 | + $this->eventDispatcher->dispatch(new GenericEvent($existingPackage, ['eventName' => Events::PACKAGE_PRE_UPDATE]), Events::PACKAGE_PRE_UPDATE); |
|
148 | 148 | $this->packageObjectManager->flush(); |
149 | - $this->eventDispatcher->dispatch( new GenericEvent($existingPackage, ['eventName' => Events::PACKAGE_POST_UPDATE]), Events::PACKAGE_POST_UPDATE); |
|
150 | - $this->eventDispatcher->dispatch( new GenericEvent($existingPackage, ['eventName' => Events::PACKAGE_PROCESSED]), Events::PACKAGE_PROCESSED); |
|
149 | + $this->eventDispatcher->dispatch(new GenericEvent($existingPackage, ['eventName' => Events::PACKAGE_POST_UPDATE]), Events::PACKAGE_POST_UPDATE); |
|
150 | + $this->eventDispatcher->dispatch(new GenericEvent($existingPackage, ['eventName' => Events::PACKAGE_PROCESSED]), Events::PACKAGE_PROCESSED); |
|
151 | 151 | $this->packageObjectManager->flush(); |
152 | 152 | |
153 | 153 | $this->logger->info(sprintf('Package %s was updated', $existingPackage->getGuid())); |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | ); |
177 | 177 | } |
178 | 178 | |
179 | - $this->eventDispatcher->dispatch( new GenericEvent($package, ['eventName' => Events::PACKAGE_PRE_CREATE]), Events::PACKAGE_PRE_CREATE); |
|
179 | + $this->eventDispatcher->dispatch(new GenericEvent($package, ['eventName' => Events::PACKAGE_PRE_CREATE]), Events::PACKAGE_PRE_CREATE); |
|
180 | 180 | $this->packageRepository->add($package); |
181 | - $this->eventDispatcher->dispatch( new GenericEvent($package, ['eventName' => Events::PACKAGE_POST_CREATE]), Events::PACKAGE_POST_CREATE); |
|
182 | - $this->eventDispatcher->dispatch( new GenericEvent($package, ['eventName' => Events::PACKAGE_PROCESSED]), Events::PACKAGE_PROCESSED); |
|
181 | + $this->eventDispatcher->dispatch(new GenericEvent($package, ['eventName' => Events::PACKAGE_POST_CREATE]), Events::PACKAGE_POST_CREATE); |
|
182 | + $this->eventDispatcher->dispatch(new GenericEvent($package, ['eventName' => Events::PACKAGE_PROCESSED]), Events::PACKAGE_PROCESSED); |
|
183 | 183 | |
184 | 184 | if (!empty($options)) { |
185 | 185 | $this->eventDispatcher->dispatch( |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | class ContentPushController extends AbstractController { |
45 | 45 | private EventDispatcherInterface $eventDispatcher; |
46 | 46 | private FormFactoryInterface $formFactory; |
47 | - private MessageBusInterface $messageBus;//swp_multi_tenancy.tenant_context |
|
47 | + private MessageBusInterface $messageBus; //swp_multi_tenancy.tenant_context |
|
48 | 48 | private DataTransformerInterface $dataTransformer; // swp_bridge.transformer.json_to_package |
49 | 49 | private MediaManagerInterface $mediaManager; // swp_content_bundle.manager.media |
50 | 50 | private EntityManagerInterface $entityManager; // swp.object_manager.media |
51 | - private PackageRepository $packageRepository;//swp.repository.package |
|
52 | - private ArticleRepositoryInterface $articleRepository;//swp.repository.article |
|
51 | + private PackageRepository $packageRepository; //swp.repository.package |
|
52 | + private ArticleRepositoryInterface $articleRepository; //swp.repository.article |
|
53 | 53 | private FileProviderInterface $fileProvider; |
54 | 54 | |
55 | 55 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | ); |
173 | 173 | } |
174 | 174 | |
175 | - throw new \Exception('Uploaded file is not valid:' . $uploadedFile->getErrorMessage()); |
|
175 | + throw new \Exception('Uploaded file is not valid:'.$uploadedFile->getErrorMessage()); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | return new SingleResourceResponse($form); |
@@ -65,8 +65,8 @@ |
||
65 | 65 | throw new AccessDeniedException('This user does not have access to this section.'); |
66 | 66 | } |
67 | 67 | |
68 | - $limit = (int)$request->query->get('limit', 10); |
|
69 | - $page = (int)$request->query->get('page', 1); |
|
68 | + $limit = (int) $request->query->get('limit', 10); |
|
69 | + $page = (int) $request->query->get('page', 1); |
|
70 | 70 | $profilesQuery = $this->userRepository->createQueryBuilder('u') |
71 | 71 | ->orderBy('u.id', 'ASC') |
72 | 72 | ->getQuery(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $status['postgres'] = 'green'; |
36 | 36 | } |
37 | 37 | } catch (\Throwable $e) { |
38 | - error_log('PostgreSQL health check failed: ' . $e->getMessage()); |
|
38 | + error_log('PostgreSQL health check failed: '.$e->getMessage()); |
|
39 | 39 | $status['postgres'] = 'red'; |
40 | 40 | } |
41 | 41 | |
@@ -44,20 +44,20 @@ discard block |
||
44 | 44 | $elasticaClient->getStatus(); |
45 | 45 | $status['elasticsearch'] = 'green'; |
46 | 46 | } catch (\Throwable $e) { |
47 | - error_log('Elasticsearch health check failed: ' . $e->getMessage()); |
|
47 | + error_log('Elasticsearch health check failed: '.$e->getMessage()); |
|
48 | 48 | $status['elasticsearch'] = 'red'; |
49 | 49 | } |
50 | 50 | |
51 | 51 | // Check Memcached |
52 | 52 | try { |
53 | - $cacheKey = 'health_check_' . uniqid(); |
|
53 | + $cacheKey = 'health_check_'.uniqid(); |
|
54 | 54 | $cacheItem = $cachePool->getItem($cacheKey); |
55 | 55 | $cacheItem->set('ok'); |
56 | 56 | $cachePool->save($cacheItem); |
57 | 57 | $cachePool->deleteItem($cacheKey); |
58 | 58 | $status['memcached'] = 'green'; |
59 | 59 | } catch (\Throwable $e) { |
60 | - error_log('Memcached health check failed: ' . $e->getMessage()); |
|
60 | + error_log('Memcached health check failed: '.$e->getMessage()); |
|
61 | 61 | $status['memcached'] = 'red'; |
62 | 62 | } |
63 | 63 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | try { |
66 | 66 | $amqp = new \AMQPConnection([ |
67 | 67 | 'host' => $_ENV['RABBIT_MQ_HOST'] ?? 'localhost', |
68 | - 'port' => (int)($_ENV['RABBIT_MQ_PORT'] ?? 5672), |
|
68 | + 'port' => (int) ($_ENV['RABBIT_MQ_PORT'] ?? 5672), |
|
69 | 69 | 'login' => $_ENV['RABBIT_MQ_USER'] ?? 'guest', |
70 | 70 | 'password' => $_ENV['RABBIT_MQ_PASSWORD'] ?? 'guest', |
71 | 71 | 'vhost' => $_ENV['RABBIT_MQ_VHOST'] ?? '/', |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $status['rabbitmq'] = 'green'; |
76 | 76 | } |
77 | 77 | } catch (\Throwable $e) { |
78 | - error_log('RabbitMQ health check failed: ' . $e->getMessage()); |
|
78 | + error_log('RabbitMQ health check failed: '.$e->getMessage()); |
|
79 | 79 | $status['rabbitmq'] = 'red'; |
80 | 80 | } |
81 | 81 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $status['supervisor'] = 'red'; |
111 | 111 | } |
112 | 112 | } catch (\Throwable $e) { |
113 | - error_log('Supervisor health check failed: ' . $e->getMessage()); |
|
113 | + error_log('Supervisor health check failed: '.$e->getMessage()); |
|
114 | 114 | $status['supervisor'] = 'red'; |
115 | 115 | } |
116 | 116 |