diff --git a/src/CantoDamAssets.php b/src/CantoDamAssets.php index 7e89ac9..85f8b71 100644 --- a/src/CantoDamAssets.php +++ b/src/CantoDamAssets.php @@ -40,7 +40,7 @@ public function init(): void self::$plugin = self::getInstance(); // Defer most setup tasks until Craft is fully initialized - Craft::$app->onInit(function () { + Craft::$app->onInit(function() { $this->attachEventHandlers(); }); } @@ -74,7 +74,7 @@ protected function attachEventHandlers(): void Event::on( CraftVariable::class, CraftVariable::EVENT_INIT, - function (Event $event) { + function(Event $event) { /** @var CraftVariable $variable */ $variable = $event->sender; $variable->set('canto', [ @@ -86,21 +86,21 @@ function (Event $event) { Event::on( Fields::class, Fields::EVENT_REGISTER_FIELD_TYPES, - static function (RegisterComponentTypesEvent $event) { + static function(RegisterComponentTypesEvent $event) { $event->types[] = CantoDamAsset::class; }); // Add permission for Editors Event::on( UserPermissions::class, UserPermissions::EVENT_REGISTER_PERMISSIONS, - function (RegisterUserPermissionsEvent $event) { + function(RegisterUserPermissionsEvent $event) { $event->permissions[] = [ "heading" => "Canto DAM Assets Picker Extraordinaire", "permissions" => [ 'accessPlugin-_canto-dam-assets' => [ 'label' => 'Use Canto DAM Assets Fields', ], - ] + ], ]; } ); diff --git a/src/fields/CantoDamAsset.php b/src/fields/CantoDamAsset.php index 36a2f1f..6a1eb98 100644 --- a/src/fields/CantoDamAsset.php +++ b/src/fields/CantoDamAsset.php @@ -22,7 +22,6 @@ */ class CantoDamAsset extends Field implements PreviewableFieldInterface { - protected const PICKER_TYPE_CLASS_MAP = [ 'singleImagePicker' => 'can-select-single', 'multipleImagePicker' => 'can-select-single can-select-multiple', @@ -320,13 +319,13 @@ protected function getGqlArguments(): array 'fields' => [ 'page' => [ 'type' => Type::int(), - 'description' => 'The page number' + 'description' => 'The page number', ], 'items' => [ 'type' => Type::int(), - 'description' => 'The number of items per page' + 'description' => 'The number of items per page', ], - ] + ], ]), ], 'where' => [ @@ -337,17 +336,17 @@ protected function getGqlArguments(): array 'fields' => [ 'key' => [ 'type' => Type::string(), - 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields' + 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields', ], 'value' => [ 'type' => Type::string(), - 'description' => 'The value to match when searching' + 'description' => 'The value to match when searching', ], 'operator' => [ 'type' => Type::string(), - 'description' => 'The comparison operator to use, e.g.: `=`, `>`, `<=`, etc. The default is `=`' - ] - ] + 'description' => 'The comparison operator to use, e.g.: `=`, `>`, `<=`, etc. The default is `=`', + ], + ], ]), ], 'whereNull' => [ @@ -368,13 +367,13 @@ protected function getGqlArguments(): array 'fields' => [ 'key' => [ 'type' => Type::string(), - 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields' + 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields', ], 'values' => [ 'type' => Type::listOf(Type::string()), - 'description' => 'The values that should be in the key' + 'description' => 'The values that should be in the key', ], - ] + ], ]), ], 'whereNotIn' => [ @@ -385,13 +384,13 @@ protected function getGqlArguments(): array 'fields' => [ 'key' => [ 'type' => Type::string(), - 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields' + 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields', ], 'values' => [ 'type' => Type::listOf(Type::string()), - 'description' => 'The the values that should not be in the key' + 'description' => 'The the values that should not be in the key', ], - ] + ], ]), ], 'whereBetween' => [ @@ -402,13 +401,13 @@ protected function getGqlArguments(): array 'fields' => [ 'key' => [ 'type' => Type::string(), - 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields' + 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields', ], 'values' => [ 'type' => Type::listOf(Type::string()), - 'description' => 'The values that the key should be between' + 'description' => 'The values that the key should be between', ], - ] + ], ]), ], 'whereNotBetween' => [ @@ -419,13 +418,13 @@ protected function getGqlArguments(): array 'fields' => [ 'key' => [ 'type' => Type::string(), - 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields' + 'description' => 'The key to search on, you can use the `field.subField` syntax for nested fields', ], 'values' => [ 'type' => Type::listOf(Type::string()), - 'description' => 'The values the key should not be between' + 'description' => 'The values the key should not be between', ], - ] + ], ]), ], ], 'CantoDamAssetQueryType'); diff --git a/src/gql/interfaces/CantoDamAssetInterface.php b/src/gql/interfaces/CantoDamAssetInterface.php index a5893c2..fd73f04 100644 --- a/src/gql/interfaces/CantoDamAssetInterface.php +++ b/src/gql/interfaces/CantoDamAssetInterface.php @@ -28,7 +28,7 @@ public static function getType($fields = null): Type 'name' => static::getName(), 'fields' => self::class . '::getFieldDefinitions', 'description' => 'This is the interface implemented by CantoDamAsset.', - 'resolveType' => function (array $value) { + 'resolveType' => function(array $value) { return GqlEntityRegistry::getEntity(CantoDamAssetGenerator::getName()); }, ])); @@ -80,7 +80,7 @@ public static function getFieldDefinitions(): array 'Has Color Map' => Type::string(), 'Frame Count' => Type::string(), 'Panoramas' => Type::string(), - ]) + ]), ]), 'height' => Type::string(), 'relatedAlbums' => Type::listOf(new ObjectType([ @@ -101,7 +101,7 @@ public static function getFieldDefinitions(): array 'id' => Type::string(), 'size' => Type::string(), 'schema' => Type::string(), - ] + ], ])), 'md5' => Type::string(), 'approvalStatus' => Type::string(), @@ -126,7 +126,7 @@ public static function getFieldDefinitions(): array ], ]), 'currentVersion' => Type::string(), - ] + ], ])), 'created' => Type::string(), 'keyword' => Type::listOf(Type::string()), @@ -167,7 +167,7 @@ public static function getFieldDefinitions(): array 'Caption **EN**' => Type::string(), 'Usage Terms' => Type::string(), 'WebDAM Media Type' => Type::string(), - ]) + ]), ]), 'url' => new ObjectType([ 'name' => 'CantoUrlType', @@ -182,7 +182,7 @@ public static function getFieldDefinitions(): array 'directUrlPreview' => Type::string(), 'directUrlPreviewPlay' => Type::string(), 'LowJPG' => Type::string(), - ] + ], ]), 'width' => Type::string(), 'name' => Type::string(), @@ -203,7 +203,7 @@ public static function getFieldDefinitions(): array 'Author' => Type::string(), 'Date Created' => Type::string(), 'Resolution' => Type::string(), - ]) + ]), ]), 'id' => Type::string(), 'size' => Type::string(), diff --git a/src/gql/types/generators/CantoDamAssetGenerator.php b/src/gql/types/generators/CantoDamAssetGenerator.php index 50b8eda..b27d167 100644 --- a/src/gql/types/generators/CantoDamAssetGenerator.php +++ b/src/gql/types/generators/CantoDamAssetGenerator.php @@ -5,7 +5,6 @@ use craft\gql\base\GeneratorInterface; use craft\gql\GqlEntityRegistry; use craft\gql\TypeLoader; -use GraphQL\Type\Definition\Type; use lsst\cantodamassets\gql\interfaces\CantoDamAssetInterface; use lsst\cantodamassets\gql\types\CantoDamAssetType; @@ -19,14 +18,14 @@ public static function generateTypes(mixed $context = null): array $cantoDamAssetType = GqlEntityRegistry::getEntity($typeName) ?: GqlEntityRegistry::createEntity($typeName, new CantoDamAssetType([ 'name' => $typeName, - 'fields' => function () use ($cantoDamAssetFields) { + 'fields' => function() use ($cantoDamAssetFields) { return $cantoDamAssetFields; }, 'description' => 'This entity has all the Canto Dam Asset fields', ])); $gqlTypes[$typeName] = $cantoDamAssetType; - TypeLoader::registerType($typeName, function () use ($cantoDamAssetType) { + TypeLoader::registerType($typeName, function() use ($cantoDamAssetType) { return $cantoDamAssetType; }); diff --git a/src/jobs/DeleteByAlbumId.php b/src/jobs/DeleteByAlbumId.php index 955e5de..aafa1bf 100644 --- a/src/jobs/DeleteByAlbumId.php +++ b/src/jobs/DeleteByAlbumId.php @@ -27,7 +27,7 @@ public function execute($queue): void protected function defaultDescription(): ?string { return Translation::prep('_canto-dam-assets', 'Deleting Canto Album id {id}', [ - 'id' => $this->id + 'id' => $this->id, ]); } } diff --git a/src/jobs/DeleteByCantoId.php b/src/jobs/DeleteByCantoId.php index 9775e0b..8c5f55f 100644 --- a/src/jobs/DeleteByCantoId.php +++ b/src/jobs/DeleteByCantoId.php @@ -27,7 +27,7 @@ public function execute($queue): void protected function defaultDescription(): ?string { return Translation::prep('_canto-dam-assets', 'Deleting Canto Asset id {id}', [ - 'id' => $this->id + 'id' => $this->id, ]); } } diff --git a/src/jobs/UpdateByAlbumId.php b/src/jobs/UpdateByAlbumId.php index 478349d..956b9d2 100644 --- a/src/jobs/UpdateByAlbumId.php +++ b/src/jobs/UpdateByAlbumId.php @@ -32,7 +32,7 @@ public function execute($queue): void protected function defaultDescription(): ?string { return Translation::prep('_canto-dam-assets', 'Updating Canto Album id {id}', [ - 'id' => $this->id + 'id' => $this->id, ]); } } diff --git a/src/jobs/UpdateByCantoId.php b/src/jobs/UpdateByCantoId.php index a82633f..8ea1718 100644 --- a/src/jobs/UpdateByCantoId.php +++ b/src/jobs/UpdateByCantoId.php @@ -32,7 +32,7 @@ public function execute($queue): void protected function defaultDescription(): ?string { return Translation::prep('_canto-dam-assets', 'Updating Canto Asset id {id}', [ - 'id' => $this->id + 'id' => $this->id, ]); } } diff --git a/src/lib/laravel/Collection.php b/src/lib/laravel/Collection.php index c3de805..d26571e 100644 --- a/src/lib/laravel/Collection.php +++ b/src/lib/laravel/Collection.php @@ -18,7 +18,7 @@ public function whereIn($key, $values, $strict = false) { $values = $this->getArrayableItems($values); - return $this->filter(function ($item) use ($key, $values, $strict) { + return $this->filter(function($item) use ($key, $values, $strict) { $item = data_get($item, $key); // Handle the case where the data is an array of items if (is_array($item)) { @@ -40,7 +40,7 @@ public function whereNotIn($key, $values, $strict = false) { $values = $this->getArrayableItems($values); - return $this->reject(function ($item) use ($key, $values, $strict) { + return $this->reject(function($item) use ($key, $values, $strict) { $item = data_get($item, $key); // Handle the case where the data is an array of items if (is_array($item)) { @@ -76,10 +76,10 @@ protected function operatorForWhere($key, $operator = null, $value = null) $operator = '='; } - return function ($item) use ($key, $operator, $value) { + return function($item) use ($key, $operator, $value) { $retrieved = data_get($item, $key); - $strings = array_filter([$retrieved, $value], function ($value) { + $strings = array_filter([$retrieved, $value], function($value) { return is_string($value) || (is_object($value) && method_exists($value, '__toString')); }); diff --git a/src/migrations/m231108_024521_change_to_json_column.php b/src/migrations/m231108_024521_change_to_json_column.php index 015d1bc..063ce89 100644 --- a/src/migrations/m231108_024521_change_to_json_column.php +++ b/src/migrations/m231108_024521_change_to_json_column.php @@ -18,7 +18,6 @@ */ class m231108_024521_change_to_json_column extends Migration { - private const CONTENT_COLUMN_KEYS = [ 'cantoAssetData', 'cantoAlbumData', diff --git a/src/models/CantoFieldData.php b/src/models/CantoFieldData.php index bc7f579..d8be6a9 100644 --- a/src/models/CantoFieldData.php +++ b/src/models/CantoFieldData.php @@ -44,11 +44,11 @@ public function defineRules(): array [ [ 'cantoId', - 'cantoAlbumId' + 'cantoAlbumId', ], [ 'string', - 'skipOnEmpty' => true + 'skipOnEmpty' => true, ], ], [ diff --git a/src/models/Settings.php b/src/models/Settings.php index 1f09feb..f9d5c42 100644 --- a/src/models/Settings.php +++ b/src/models/Settings.php @@ -86,7 +86,7 @@ public function defineRules(): array 'appId', 'authEndpoint', 'tenantHostName', - 'secretKey' + 'secretKey', ], 'required', ], @@ -106,7 +106,7 @@ public function defineRules(): array 'url', ], [ - 'authEndpoint', 'default', 'value' => 'https://oauth.canto.com/oauth/api/oauth2/token?app_id={appId}&app_secret={secretKey}&grant_type=client_credentials&refresh_token=' + 'authEndpoint', 'default', 'value' => 'https://oauth.canto.com/oauth/api/oauth2/token?app_id={appId}&app_secret={secretKey}&grant_type=client_credentials&refresh_token=', ], ]; } diff --git a/src/services/Api.php b/src/services/Api.php index 3285bd6..04a1310 100644 --- a/src/services/Api.php +++ b/src/services/Api.php @@ -90,7 +90,7 @@ public function cantoApiRequest(string $path, array $params = []): array if (!is_array($body)) { return [ "status" => "error", - 'errorMessage' => 'Canto endpoint failure' + 'errorMessage' => 'Canto endpoint failure', ]; } @@ -184,8 +184,8 @@ public function getApiHeaders(): array return [ 'headers' => [ 'Authorization' => 'bearer ' . $this->getAuthToken(), - 'Content-Type' => 'application/x-www-form-urlencoded' - ] + 'Content-Type' => 'application/x-www-form-urlencoded', + ], ]; } diff --git a/src/services/ServicesTrait.php b/src/services/ServicesTrait.php index c92c0ed..45ddb53 100644 --- a/src/services/ServicesTrait.php +++ b/src/services/ServicesTrait.php @@ -40,7 +40,7 @@ public static function config(): array 'errorEntry' => 'src/js/app.ts', 'useDevServer' => true, ], - ] + ], ]; } diff --git a/src/translations/en/_canto-dam-assets.php b/src/translations/en/_canto-dam-assets.php index a71ca8a..0091d07 100644 --- a/src/translations/en/_canto-dam-assets.php +++ b/src/translations/en/_canto-dam-assets.php @@ -25,5 +25,5 @@ 'Updating Canto Asset id {id}' => 'Updating Canto Asset id {id}', 'Deleting Canto Asset id {id}' => 'Deleting Canto Asset id {id}', 'Updating Canto Album id {id}' => 'Updating Canto Album id {id}', - 'Deleting Canto Album id {id}' => 'Deleting Canto Album id {id}' + 'Deleting Canto Album id {id}' => 'Deleting Canto Album id {id}', ];