Format code using php-cs-fixer

This commit is contained in:
jo 2021-10-11 16:10:47 +02:00
parent 43d7dc92cd
commit d52c6184b9
352 changed files with 17473 additions and 17041 deletions

View file

@ -12,29 +12,36 @@ class Application_Model_RabbitMq
self::$doPush = true;
}
private static function sendMessage($exchange, $exchangeType, $autoDeleteExchange, $data, $queue="")
private static function sendMessage($exchange, $exchangeType, $autoDeleteExchange, $data, $queue = '')
{
$CC_CONFIG = Config::getConfig();
$conn = new \PhpAmqpLib\Connection\AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
$CC_CONFIG["rabbitmq"]["port"],
$CC_CONFIG["rabbitmq"]["user"],
$CC_CONFIG["rabbitmq"]["password"],
$CC_CONFIG["rabbitmq"]["vhost"]);
$conn = new \PhpAmqpLib\Connection\AMQPConnection(
$CC_CONFIG['rabbitmq']['host'],
$CC_CONFIG['rabbitmq']['port'],
$CC_CONFIG['rabbitmq']['user'],
$CC_CONFIG['rabbitmq']['password'],
$CC_CONFIG['rabbitmq']['vhost']
);
if (!isset($conn)) {
throw new Exception("Cannot connect to RabbitMQ server");
throw new Exception('Cannot connect to RabbitMQ server');
}
$channel = $conn->channel();
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false,
true, true);
$channel->access_request(
$CC_CONFIG['rabbitmq']['vhost'],
false,
false,
true,
true
);
//I'm pretty sure we DON'T want to autodelete ANY exchanges but I'm keeping the code
//the way it is just so I don't accidentally break anything when I add the Analyzer code in. -- Albert, March 13, 2014
$channel->exchange_declare($exchange, $exchangeType, false, true, $autoDeleteExchange);
$msg = new \PhpAmqpLib\Message\AMQPMessage($data, array('content_type' => 'text/plain'));
$msg = new \PhpAmqpLib\Message\AMQPMessage($data, ['content_type' => 'text/plain']);
$channel->basic_publish($msg, $exchange);
$channel->close();
@ -43,7 +50,7 @@ class Application_Model_RabbitMq
public static function SendMessageToPypo($event_type, $md)
{
$md["event_type"] = $event_type;
$md['event_type'] = $event_type;
$exchange = 'airtime-pypo';
$data = json_encode($md, JSON_FORCE_OBJECT);
@ -52,7 +59,7 @@ class Application_Model_RabbitMq
public static function SendMessageToMediaMonitor($event_type, $md)
{
$md["event_type"] = $event_type;
$md['event_type'] = $event_type;
$exchange = 'airtime-analyzer';
$data = json_encode($md);
@ -63,32 +70,43 @@ class Application_Model_RabbitMq
{
$exchange = 'airtime-pypo';
$now = new DateTime("@".time()); //in UTC timezone
$end_timestamp = new DateTime("@".(time() + 3600*2)); //in UTC timezone
$now = new DateTime('@' . time()); //in UTC timezone
$end_timestamp = new DateTime('@' . (time() + 3600 * 2)); //in UTC timezone
$temp = array();
$temp = [];
$temp['event_type'] = $event_type;
$temp['server_timezone'] = Application_Model_Preference::GetTimezone();
if ($event_type == "update_recorder_schedule") {
$temp['shows'] = Application_Model_Show::getShows($now,
$end_timestamp, $onlyRecord=true);
if ($event_type == 'update_recorder_schedule') {
$temp['shows'] = Application_Model_Show::getShows(
$now,
$end_timestamp,
$onlyRecord = true
);
}
$data = json_encode($temp);
self::sendMessage($exchange, 'direct', true, $data);
}
public static function SendMessageToAnalyzer($tmpFilePath, $importedStorageDirectory, $originalFilename,
$callbackUrl, $apiKey, $storageBackend, $filePrefix)
{
public static function SendMessageToAnalyzer(
$tmpFilePath,
$importedStorageDirectory,
$originalFilename,
$callbackUrl,
$apiKey,
$storageBackend,
$filePrefix
) {
$config = Config::getConfig();
$conn = new \PhpAmqpLib\Connection\AMQPConnection($config["rabbitmq"]["host"],
$config["rabbitmq"]["port"],
$config["rabbitmq"]["user"],
$config["rabbitmq"]["password"],
$config["rabbitmq"]["vhost"]);
$conn = new \PhpAmqpLib\Connection\AMQPConnection(
$config['rabbitmq']['host'],
$config['rabbitmq']['port'],
$config['rabbitmq']['user'],
$config['rabbitmq']['password'],
$config['rabbitmq']['vhost']
);
$exchange = 'airtime-uploads';
$exchangeType = 'topic';
$queue = 'airtime-uploads';
@ -101,32 +119,36 @@ class Application_Model_RabbitMq
$data['api_key'] = $apiKey;
// We add a prefix to the resource name so files are not all placed
// under the root folder. We do this in case we need to restore a
// under the root folder. We do this in case we need to restore a
// customer's file/s; File restoration is done via the S3 Browser
// client. The client will hang if there are too many files under the
// same folder.
$data['file_prefix'] = $filePrefix;
$jsonData = json_encode($data);
//self::sendMessage($exchange, 'topic', false, $jsonData, 'airtime-uploads');
if (!isset($conn)) {
throw new Exception("Cannot connect to RabbitMQ server");
throw new Exception('Cannot connect to RabbitMQ server');
}
$channel = $conn->channel();
$channel->access_request($config["rabbitmq"]["vhost"], false, false,
true, true);
$channel->access_request(
$config['rabbitmq']['vhost'],
false,
false,
true,
true
);
//I'm pretty sure we DON'T want to autodelete ANY exchanges but I'm keeping the code
//the way it is just so I don't accidentally break anything when I add the Analyzer code in. -- Albert, March 13, 2014
$channel->exchange_declare($exchange, $exchangeType, false, true, $autoDeleteExchange);
$msg = new \PhpAmqpLib\Message\AMQPMessage($jsonData, array('content_type' => 'text/plain'));
$msg = new \PhpAmqpLib\Message\AMQPMessage($jsonData, ['content_type' => 'text/plain']);
$channel->basic_publish($msg, $exchange);
$channel->close();
$conn->close();
}
}