|
4 | 4 |
|
5 | 5 | use Code_Snippets\Snippet; |
6 | 6 | use WP_Error; |
7 | | -use function Code_Snippets\code_snippets; |
8 | 7 | use function Code_Snippets\get_snippet_by_cloud_id; |
9 | 8 | use function Code_Snippets\get_snippets; |
10 | 9 | use function Code_Snippets\save_snippet; |
@@ -70,43 +69,6 @@ public static function get_cloud_api_url(): string { |
70 | 69 | : self::get_cloud_url() . 'api/v1/'; |
71 | 70 | } |
72 | 71 |
|
73 | | - /** |
74 | | - * Retrieve cloud settings. |
75 | | - * |
76 | | - * @return array |
77 | | - */ |
78 | | - private static function get_cloud_settings(): array { |
79 | | - static $settings = null; |
80 | | - |
81 | | - if ( ! is_null( $settings ) ) { |
82 | | - return $settings; |
83 | | - } |
84 | | - |
85 | | - $settings = wp_cache_get( self::CLOUD_SETTINGS_CACHE_KEY ); |
86 | | - if ( $settings ) { |
87 | | - return $settings; |
88 | | - } |
89 | | - |
90 | | - $settings = get_option( self::CLOUD_SETTINGS_CACHE_KEY ); |
91 | | - |
92 | | - // Check if the settings exist in the database if not create defaults. |
93 | | - if ( false === $settings ) { |
94 | | - $settings = [ |
95 | | - 'cloud_token' => '', |
96 | | - 'local_token' => '', |
97 | | - 'token_verified' => false, |
98 | | - 'code_verifier' => '', |
99 | | - 'code_challenge' => '', |
100 | | - 'state' => '', |
101 | | - ]; |
102 | | - |
103 | | - update_option( self::CLOUD_SETTINGS_CACHE_KEY, $settings ); |
104 | | - } |
105 | | - |
106 | | - wp_cache_set( self::CLOUD_SETTINGS_CACHE_KEY, $settings ); |
107 | | - return $settings; |
108 | | - } |
109 | | - |
110 | 72 | /** |
111 | 73 | * Retrieve the cloud local token. |
112 | 74 | * |
@@ -335,6 +297,8 @@ public static function get_cloud_snippet_revision( string $cloud_id ): ?string { |
335 | 297 | * @param string $action The action to be performed: 'download' or 'update'. |
336 | 298 | * |
337 | 299 | * @return array<string, string|bool> Result of operation: an array with `success` and `error_message` keys. |
| 300 | + * |
| 301 | + * @noinspection PhpUnusedParameterInspection |
338 | 302 | */ |
339 | 303 | public function download_or_update_snippet( int $cloud_id, string $source, string $action ): array { |
340 | 304 | $cloud_id = intval( $cloud_id ); |
|
0 commit comments