From 2da4b1c8a6ee1dea8a15746af66ee016a8fe5b0c Mon Sep 17 00:00:00 2001 From: lmajano Date: Wed, 19 Apr 2023 14:05:36 +0000 Subject: [PATCH] Apply cfformat changes --- models/AbstractStorage.cfc | 2 +- models/ApplicationStorage.cfc | 4 +-- models/CGIStorage.cfc | 4 +-- models/CacheStorage.cfc | 34 +++++-------------- models/ClientStorage.cfc | 4 +-- models/CookieStorage.cfc | 21 ++++++------ models/IStorage.cfc | 7 ++-- models/RequestStorage.cfc | 4 +-- models/SessionStorage.cfc | 4 +-- .../tests/specs/CookieStorageTest.cfc | 9 +---- 10 files changed, 33 insertions(+), 60 deletions(-) diff --git a/models/AbstractStorage.cfc b/models/AbstractStorage.cfc index 2c973e8..adbf6c5 100644 --- a/models/AbstractStorage.cfc +++ b/models/AbstractStorage.cfc @@ -37,7 +37,7 @@ component accessors="true" serializable="false" { * call the `produce` closure/lambda to produce the required value and store it * in the storage using the passed named key. * - * @name The name of the key to get + * @name The name of the key to get * @produce The closure/lambda to execute that should produce the value */ any function getOrSet( required name, required any produce ){ diff --git a/models/ApplicationStorage.cfc b/models/ApplicationStorage.cfc index f31857c..b28025d 100755 --- a/models/ApplicationStorage.cfc +++ b/models/ApplicationStorage.cfc @@ -28,7 +28,7 @@ component /** * Set a new variable in storage * - * @name The name of the data key + * @name The name of the data key * @value The value of the data to store * * @return cbstorages.models.IStorage @@ -44,7 +44,7 @@ component /** * Get a new variable in storage if it exists, else return default value, else will return null. * - * @name The name of the data key + * @name The name of the data key * @defaultValue The default value to return if not found in storage */ any function get( required name, defaultValue ){ diff --git a/models/CGIStorage.cfc b/models/CGIStorage.cfc index df6b1a9..10a36a7 100644 --- a/models/CGIStorage.cfc +++ b/models/CGIStorage.cfc @@ -27,7 +27,7 @@ component /** * Set a new variable in storage * - * @name The name of the data key + * @name The name of the data key * @value The value of the data to store * * @return cbstorages.models.IStorage @@ -41,7 +41,7 @@ component /** * Get a new variable in storage if it exists, else return default value, else will return null. * - * @name The name of the data key + * @name The name of the data key * @defaultValue The default value to return if not found in storage */ any function get( required name, defaultValue ){ diff --git a/models/CacheStorage.cfc b/models/CacheStorage.cfc index d427256..148a7e6 100644 --- a/models/CacheStorage.cfc +++ b/models/CacheStorage.cfc @@ -37,8 +37,8 @@ component /** * Constructor * - * @settings The storage settings struct - * @cachebox A reference to CacheBox + * @settings The storage settings struct + * @cachebox A reference to CacheBox * @settings.inject coldbox:moduleSettings:cbstorages * @cachebox.inject cachebox */ @@ -65,7 +65,7 @@ component /** * Set a new variable in storage * - * @name The name of the data key + * @name The name of the data key * @value The value of the data to store * * @return cbstorages.models.IStorage @@ -75,12 +75,7 @@ component // store in bucket storage[ arguments.name ] = arguments.value; // save it back in cache - cache.set( - getSessionKey(), - storage, - variables.timeout, - 0 - ); + cache.set( getSessionKey(), storage, variables.timeout, 0 ); return this; } @@ -88,7 +83,7 @@ component /** * Get a new variable in storage if it exists, else return default value, else will return null. * - * @name The name of the data key + * @name The name of the data key * @defaultValue The default value to return if not found in storage */ any function get( required name, defaultValue ){ @@ -114,12 +109,7 @@ component if ( structKeyExists( storage, arguments.name ) ) { structDelete( storage, arguments.name ); // store it back - cache.set( - getSessionKey(), - storage, - variables.timeout, - 0 - ); + cache.set( getSessionKey(), storage, variables.timeout, 0 ); return true; } return false; @@ -144,16 +134,8 @@ component var storage = cache.get( cacheKey ); // Verify, else create it if ( isNull( local.storage ) ) { - storage = { - "sessionid" : cacheKey, - "timecreated" : now() - }; - cache.set( - cacheKey, - storage, - variables.timeout, - 0 - ); + storage = { "sessionid" : cacheKey, "timecreated" : now() }; + cache.set( cacheKey, storage, variables.timeout, 0 ); } return storage; diff --git a/models/ClientStorage.cfc b/models/ClientStorage.cfc index d6aa980..8f4b690 100755 --- a/models/ClientStorage.cfc +++ b/models/ClientStorage.cfc @@ -22,7 +22,7 @@ component /** * Set a new variable in storage * - * @name The name of the data key + * @name The name of the data key * @value The value of the data to store * * @return cbstorages.models.IStorage @@ -40,7 +40,7 @@ component /** * Get a new variable in storage if it exists, else return default value, else will return null. * - * @name The name of the data key + * @name The name of the data key * @defaultValue The default value to return if not found in storage */ any function get( required name, defaultValue ){ diff --git a/models/CookieStorage.cfc b/models/CookieStorage.cfc index dde2720..4578170 100644 --- a/models/CookieStorage.cfc +++ b/models/CookieStorage.cfc @@ -58,7 +58,7 @@ component /** * Constructor * - * @settings The storage settings struct + * @settings The storage settings struct * @settings.inject coldbox:moduleSettings:cbStorages */ function init( required settings ){ @@ -84,12 +84,12 @@ component /** * Set a new variable in storage * - * @name The name of the data key - * @value The value of the data to store - * @expires Cookie expiration - * @secure If browser does not support Secure Sockets Layer (SSL) security, the cookie is not sent. To use the cookie, the page must be accessed using the https protocol. - * @path URL, within a domain, to which the cookie applies; typically a directory. Only pages in this path can use the cookie. By default, all pages on the server that set the cookie can access the cookie. - * @domain Domain in which cookie is valid and to which cookie content can be sent from the user's system. + * @name The name of the data key + * @value The value of the data to store + * @expires Cookie expiration + * @secure If browser does not support Secure Sockets Layer (SSL) security, the cookie is not sent. To use the cookie, the page must be accessed using the https protocol. + * @path URL, within a domain, to which the cookie applies; typically a directory. Only pages in this path can use the cookie. By default, all pages on the server that set the cookie can access the cookie. + * @domain Domain in which cookie is valid and to which cookie content can be sent from the user's system. * @httpOnly Apply the httpOnly or use the storage default * @sameSite Tells browsers when and how to fire cookies in first-or third-party situations. SameSite is used to identify whether or not to allow a cookie to be accessed. Defaults not set. Available options are strict, lax, or none * @@ -154,7 +154,7 @@ component /** * Get a new variable in storage if it exists, else return default value, else will return null. * - * @name The name of the data key + * @name The name of the data key * @defaultValue The default value to return if not found in storage */ any function get( required name, defaultValue ){ @@ -190,10 +190,9 @@ component /** * Delete a variable in the storage * - * @name The name of the data key - * @path URL, within a domain, to which the cookie applies; typically a directory. Only pages in this path can use the cookie. By default, all pages on the server that set the cookie can access the cookie. + * @name The name of the data key + * @path URL, within a domain, to which the cookie applies; typically a directory. Only pages in this path can use the cookie. By default, all pages on the server that set the cookie can access the cookie. * @domain Domain in which cookie is valid and to which cookie content can be sent from the user's system. - * */ boolean function delete( required name, diff --git a/models/IStorage.cfc b/models/IStorage.cfc index c35f4d9..2210ccc 100644 --- a/models/IStorage.cfc +++ b/models/IStorage.cfc @@ -9,7 +9,7 @@ interface { /** * Set a new variable in storage * - * @name The name of the data key + * @name The name of the data key * @value The value of the data to store * * @return cbstorages.models.IStorage @@ -28,7 +28,7 @@ interface { /** * Get a new variable in storage if it exists, else return default value, else will return null. * - * @name The name of the data key + * @name The name of the data key * @defaultValue The default value to return if not found in storage */ any function get( required name, defaultValue ); @@ -38,7 +38,7 @@ interface { * call the `produce` closure/lambda to produce the required value and store it * in the storage using the passed named key. * - * @name The name of the key to get + * @name The name of the key to get * @produce The closure/lambda to execute that should produce the value */ any function getOrSet( required name, required any produce ); @@ -117,7 +117,6 @@ interface { /** * Create the storage * - * * @return cbstorages.models.IStorage */ any function createStorage(); diff --git a/models/RequestStorage.cfc b/models/RequestStorage.cfc index ca06761..e7a80da 100644 --- a/models/RequestStorage.cfc +++ b/models/RequestStorage.cfc @@ -27,7 +27,7 @@ component /** * Set a new variable in storage * - * @name The name of the data key + * @name The name of the data key * @value The value of the data to store * * @return cbstorages.models.IStorage @@ -43,7 +43,7 @@ component /** * Get a new variable in storage if it exists, else return default value, else will return null. * - * @name The name of the data key + * @name The name of the data key * @defaultValue The default value to return if not found in storage */ any function get( required name, defaultValue ){ diff --git a/models/SessionStorage.cfc b/models/SessionStorage.cfc index 879b5bc..616f1d6 100644 --- a/models/SessionStorage.cfc +++ b/models/SessionStorage.cfc @@ -25,7 +25,7 @@ component /** * Set a new variable in storage * - * @name The name of the data key + * @name The name of the data key * @value The value of the data to store * * @return cbstorages.models.IStorage @@ -41,7 +41,7 @@ component /** * Get a new variable in storage if it exists, else return default value, else will return null. * - * @name The name of the data key + * @name The name of the data key * @defaultValue The default value to return if not found in storage */ any function get( required name, defaultValue ){ diff --git a/test-harness/tests/specs/CookieStorageTest.cfc b/test-harness/tests/specs/CookieStorageTest.cfc index e4a3d93..824e53d 100755 --- a/test-harness/tests/specs/CookieStorageTest.cfc +++ b/test-harness/tests/specs/CookieStorageTest.cfc @@ -112,14 +112,7 @@ component extends="coldbox.system.testing.BaseTestCase" appMapping="/root" { expect( storage.get( "tester-encrypt" ) ).toBe( 1 ); /* Set Complex */ - storage.set( - "tester-encrypt", - { - "name" : "luis", - "now" : now(), - "kids" : [ 1, 2, 3 ] - } - ); + storage.set( "tester-encrypt", { "name" : "luis", "now" : now(), "kids" : [ 1, 2, 3 ] } ); expect( storage.exists( "tester-encrypt" ) ).toBeTrue(); expect( storage.get( "tester-encrypt" ) ).toBeStruct(); } );