Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Aug 7, 2024
1 parent 9a336a5 commit 746b8b6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"php":"8.3.9","version":"3.61.1:v3.61.1#94a87189f55814e6cabca2d9a33b06de384a2ab8","indent":"\t","lineEnding":"\n","rules":{"align_multiline_comment":true,"array_syntax":true,"backtick_to_shell_exec":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["return"]},"braces_position":{"allow_single_line_anonymous_functions":true,"allow_single_line_empty_anonymous_classes":true},"class_attributes_separation":{"elements":{"method":"one"}},"class_definition":{"single_line":true},"class_reference_name_casing":true,"clean_namespace":true,"concat_space":{"spacing":"one"},"declare_parentheses":true,"echo_tag_syntax":true,"empty_loop_body":{"style":"braces"},"empty_loop_condition":true,"function_declaration":true,"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":false,"import_constants":false,"import_functions":false},"include":true,"increment_style":{"style":"post"},"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"on_multiline":"ignore"},"native_function_casing":true,"native_type_declaration_casing":true,"no_alias_language_construct_call":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["attribute","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use"]},"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_trailing_comma_in_singleline":true,"no_unneeded_braces":{"namespaces":true},"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","switch_case","yield"]},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_nullsafe_operator":true,"no_whitespace_before_comma_in_array":true,"normalize_index_brace":true,"nullable_type_declaration_for_default_null_value":true,"object_operator_without_whitespace":true,"operator_linebreak":{"only_booleans":true,"position":"end"},"ordered_imports":{"sort_algorithm":"alpha","imports_order":null},"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":{"order":["param","return","throws"]},"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":{"groups":[["Annotation","NamedArgumentConstructor","Target"],["author","copyright","license"],["category","package","subpackage"],["property","property-read","property-write"],["deprecated","link","see","since"]]},"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_without_name":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_comment_spacing":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_space_around_construct":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"statement_indentation":{"stick_comment_to_next_continuous_control_statement":true},"switch_continue_to_break":true,"trailing_comma_in_multiline":true,"trim_array_spaces":true,"type_declaration_spaces":true,"types_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"array_indentation":true,"cast_spaces":true,"blank_line_after_opening_tag":true,"blank_lines_before_namespace":true,"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"return_type_declaration":true,"short_scalar_cast":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"multiline_comment_opening_closing":true,"no_php4_constructor":true},"hashes":{"src\/Providers\/VerifyServiceProvider.php":"4033beedfb2d885a11ba72ed079ecc6d","src\/Commands\/VerifyCommand.php":"e20b4da0327e827bb92da380b382fe71","src\/Verify.php":"478d10456aad9849ebce2df774b7966c","src\/Facades\/VerifyFacade.php":"8843c3fcda2fd90d0f5a038437fd765e","database\/factories\/ModelFactory.php":"b91e8320557f3aeeb9c15cf96b38ca6b","config\/verify.php":"295af1204a7e9598efdd938a612e63b6","tests\/TestCase.php":"9080f8ea7def78da910cd92c7442533d","src\/Exceptions\/SupporterOnlyOperationException.php":"a9f284d7f83b64ec98ff6ac8b0930b8c","src\/Exceptions\/BaseLycheeVerifyException.php":"a335da320b6989c8707315b0ada25d4c","src\/Contract\/LycheeVerifyException.php":"d0a77102de02028221a5c33c0d85efcf","src\/Http\/Middleware\/VerifySupporterStatus.php":"5a7f028399eb5a5e62bc468b05a6d042","src\/Exceptions\/CryptographyException.php":"8231ddf061a694d0fe522d18965125c2","src\/Models\/Configs.php":"7b642a2018ff131a35ab1f836ead6bd7","src\/Utils\/CheckSignature.php":"2210e6f9b6eb7d85fc7b3d1cbc370236","tests\/Verify\/CheckSignatureTest.php":"579903f6f750d60c49708d5993c65f9b","tests\/Constants.php":"3fdd71819694f03e43975e31eb44961f","src\/Validator\/ValidateSignature.php":"b124a8222a14bc10317734902c2b5eab","src\/Validator\/ValidateHash.php":"a98db96482193936c4dea75a349a6028","src\/Exceptions\/BaseVerifyException.php":"f1d29256d6fc6e201a52a6db26da818c","src\/Exceptions\/PlusOnlyOperationException.php":"1d7e38c1e58afeef563cff591a6a5b29","src\/Contract\/VerifyException.php":"3e2fca47cdadaf62035ab65ecbc4b0ca","src\/Contract\/Status.php":"894f23485b4f3c3d5fe373888e0b1502","src\/Contract\/Validator.php":"401d1d0466009e08f4a08923e6fbcb95","src\/Validators\/ValidateSignature.php":"a268c56fcac5495ea4113d88855f5e22","src\/Validators\/ValidateHash.php":"236897031cf9f9ab64370de2851046d8","database\/migrations\/create_configs_table.php":"2114868a2b73e83b4a67ba1d5148553d","tests\/Verify\/Validators\/ValidateSignatureTest.php":"e220e7eeaf69397f86d5cf5ddfd4382b","tests\/Verify\/Validators\/ValidateHashTest.php":"71a28ae0cef0848f10121a7f757026e6","tests\/Verify\/VerifyTest.php":"0ee731ea4a3b4d3728a6f2e6f75d7750"}}
{"php":"8.3.9","version":"3.61.1:v3.61.1#94a87189f55814e6cabca2d9a33b06de384a2ab8","indent":"\t","lineEnding":"\n","rules":{"align_multiline_comment":true,"array_syntax":true,"backtick_to_shell_exec":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["return"]},"braces_position":{"allow_single_line_anonymous_functions":true,"allow_single_line_empty_anonymous_classes":true},"class_attributes_separation":{"elements":{"method":"one"}},"class_definition":{"single_line":true},"class_reference_name_casing":true,"clean_namespace":true,"concat_space":{"spacing":"one"},"declare_parentheses":true,"echo_tag_syntax":true,"empty_loop_body":{"style":"braces"},"empty_loop_condition":true,"function_declaration":true,"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":false,"import_constants":false,"import_functions":false},"include":true,"increment_style":{"style":"post"},"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"on_multiline":"ignore"},"native_function_casing":true,"native_type_declaration_casing":true,"no_alias_language_construct_call":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["attribute","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use"]},"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_trailing_comma_in_singleline":true,"no_unneeded_braces":{"namespaces":true},"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","switch_case","yield"]},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_nullsafe_operator":true,"no_whitespace_before_comma_in_array":true,"normalize_index_brace":true,"nullable_type_declaration_for_default_null_value":true,"object_operator_without_whitespace":true,"operator_linebreak":{"only_booleans":true,"position":"end"},"ordered_imports":{"sort_algorithm":"alpha","imports_order":null},"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":{"order":["param","return","throws"]},"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":{"groups":[["Annotation","NamedArgumentConstructor","Target"],["author","copyright","license"],["category","package","subpackage"],["property","property-read","property-write"],["deprecated","link","see","since"]]},"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_without_name":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_comment_spacing":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_space_around_construct":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"statement_indentation":{"stick_comment_to_next_continuous_control_statement":true},"switch_continue_to_break":true,"trailing_comma_in_multiline":true,"trim_array_spaces":true,"type_declaration_spaces":true,"types_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"array_indentation":true,"cast_spaces":true,"blank_line_after_opening_tag":true,"blank_lines_before_namespace":true,"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"return_type_declaration":true,"short_scalar_cast":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"multiline_comment_opening_closing":true,"no_php4_constructor":true},"hashes":{"src\/Providers\/VerifyServiceProvider.php":"4033beedfb2d885a11ba72ed079ecc6d","src\/Commands\/VerifyCommand.php":"e20b4da0327e827bb92da380b382fe71","src\/Verify.php":"033a606ac7fa21c055746fe4e892e777","src\/Facades\/VerifyFacade.php":"8843c3fcda2fd90d0f5a038437fd765e","database\/factories\/ModelFactory.php":"b91e8320557f3aeeb9c15cf96b38ca6b","config\/verify.php":"6572979546f3bbb2f4bc87396214cd1d","tests\/TestCase.php":"a2c939a59823ac2876d606fd7e5e8ec2","src\/Exceptions\/SupporterOnlyOperationException.php":"a9f284d7f83b64ec98ff6ac8b0930b8c","src\/Exceptions\/BaseLycheeVerifyException.php":"a335da320b6989c8707315b0ada25d4c","src\/Contract\/LycheeVerifyException.php":"d0a77102de02028221a5c33c0d85efcf","src\/Http\/Middleware\/VerifySupporterStatus.php":"5a7f028399eb5a5e62bc468b05a6d042","src\/Exceptions\/CryptographyException.php":"8231ddf061a694d0fe522d18965125c2","src\/Models\/Configs.php":"7b642a2018ff131a35ab1f836ead6bd7","src\/Utils\/CheckSignature.php":"2210e6f9b6eb7d85fc7b3d1cbc370236","tests\/Verify\/CheckSignatureTest.php":"579903f6f750d60c49708d5993c65f9b","tests\/Constants.php":"3fdd71819694f03e43975e31eb44961f","src\/Validator\/ValidateSignature.php":"b124a8222a14bc10317734902c2b5eab","src\/Validator\/ValidateHash.php":"a98db96482193936c4dea75a349a6028","src\/Exceptions\/BaseVerifyException.php":"f1d29256d6fc6e201a52a6db26da818c","src\/Exceptions\/PlusOnlyOperationException.php":"1d7e38c1e58afeef563cff591a6a5b29","src\/Contract\/VerifyException.php":"3e2fca47cdadaf62035ab65ecbc4b0ca","src\/Contract\/Status.php":"894f23485b4f3c3d5fe373888e0b1502","src\/Contract\/Validator.php":"401d1d0466009e08f4a08923e6fbcb95","src\/Validators\/ValidateSignature.php":"a268c56fcac5495ea4113d88855f5e22","src\/Validators\/ValidateHash.php":"236897031cf9f9ab64370de2851046d8","database\/migrations\/create_configs_table.php":"2114868a2b73e83b4a67ba1d5148553d","tests\/Verify\/Validators\/ValidateSignatureTest.php":"e220e7eeaf69397f86d5cf5ddfd4382b","tests\/Verify\/Validators\/ValidateHashTest.php":"71a28ae0cef0848f10121a7f757026e6","tests\/Verify\/VerifyTest.php":"5683fb9fe941ac438f59b39b64c978a3","src\/VerifyServiceProvider.php":"8b9fe7d22aaac7e6a20d310addd3ce0c"}}
10 changes: 5 additions & 5 deletions config/verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

return [
'validation' => [
ValidateHash::class => '685b1e0749627c537af1bcdbb0ffa3683c2fbb5a',
ValidateSignature::class => '9518e1d258259cc0c95704a924b5ecdce8161bb2',
Verify::class => '73d86348b225eff6f6deebc4a93f00898f8475a0',
VerifySupporterStatus::class => '6358c45ed0414c1e2697e0881238659fa6221bed',
],
ValidateHash::class => '685b1e0749627c537af1bcdbb0ffa3683c2fbb5a',
ValidateSignature::class => '9518e1d258259cc0c95704a924b5ecdce8161bb2',
Verify::class => '2e5ddaf589b6f9ea30ffd4b3a30e0a48a3c7fb2d',
VerifySupporterStatus::class => '6358c45ed0414c1e2697e0881238659fa6221bed',
],
];
7 changes: 4 additions & 3 deletions src/Verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use LycheeVerify\Exceptions\SupporterOnlyOperationException;
use LycheeVerify\Validators\ValidateHash;
use LycheeVerify\Validators\ValidateSignature;

use function Safe\json_encode;
use function Safe\sha1_file;

Expand Down Expand Up @@ -112,10 +111,11 @@ public function when(mixed $valIfTrue, mixed $valIfFalse, Status $required_statu

/**
* Validate installation.
*
*
* @return bool
*/
public function validate(): bool {
public function validate(): bool
{
$checks = config('verify.validation');
if ($checks === null || count($checks) === 0) {
return false;
Expand All @@ -127,6 +127,7 @@ public function validate(): bool {
return false;
}
}

return true;
}
}
14 changes: 7 additions & 7 deletions src/VerifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

class VerifyServiceProvider extends ServiceProvider
{
public const CONFIG = __DIR__.'/../config/verify.php';
public const CONFIG = __DIR__ . '/../config/verify.php';

/**
* Register the service provider.
*
* @return void
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
* Register the service provider.
*
* @return void
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function register()
{
$this->mergeConfigFrom(static::CONFIG, 'verify');
Expand Down
5 changes: 2 additions & 3 deletions tests/Verify/VerifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use LycheeVerify\Tests\Constants;
use LycheeVerify\Tests\TestCase;
use LycheeVerify\Verify;

use function Safe\sha1_file;

class VerifyTest extends TestCase
Expand Down Expand Up @@ -60,11 +59,11 @@ public function testVerifyValidate(): void
$verify = new Verify();

// Check config before executing validation
$checks = config('verify.validation');
$checks = config('verify.validation');
foreach ($checks as $class => $value) {
$file = (new \ReflectionClass($class))->getFileName();
if ($file === false || !file_exists($file)) {
self::fail(sprintf("Validation failed for %s: file not found", $class));
self::fail(sprintf('Validation failed for %s: file not found', $class));
}
if (sha1_file($file) !== $value) {
self::fail(sprintf("Validation failed for %s: expected '%s'", $class, sha1_file($file)));
Expand Down

0 comments on commit 746b8b6

Please sign in to comment.