diff --git a/.phpcs-cache b/.phpcs-cache index 0cc703c..749528b 100644 --- a/.phpcs-cache +++ b/.phpcs-cache @@ -1 +1 @@ -{"config":{"phpVersion":80226,"phpExtensions":"6444a8d24aa127a4fe13989038fc4447","tabWidth":4,"encoding":"utf-8","recordErrors":true,"annotations":true,"configData":[],"codeHash":"b5dc58ae9d1a395f86384fd9a1678bb4","rulesetHash":"670f8348153700c3a70fc6127ca0e484"},"\/home\/carlos\/Projects\/factory\/src\/Exceptions\/ClassNotFoundException.php":{"hash":"011861a2c1e73e741c9a3ebc26e25d6f33204","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":9,"81-120":2}},"PHP keyword case":{"values":{"lower":3}},"Multiple statements on same line":{"values":{"no":1}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":46},"\/home\/carlos\/Projects\/factory\/src\/Exceptions\/ServiceNotFoundException.php":{"hash":"00acc7052806f62a3929cdbe663c3fa533204","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":10,"81-120":1}},"PHP keyword case":{"values":{"lower":3}},"Multiple statements on same line":{"values":{"no":1}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":46},"\/home\/carlos\/Projects\/factory\/src\/ServiceFactory.php":{"hash":"1d9cb1b08bc1d73bc5310cc458ebc0e733204","errors":{"160":{"13":[{"message":"No blank line found after control structure","source":"Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose","listener":"PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\WhiteSpace\\ControlStructureSpacingSniff","severity":0,"fixable":true}]}},"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":129,"81-120":17}},"Line indent":{"values":{"spaces":130}},"PHP keyword case":{"values":{"lower":70}},"Multiple statements on same line":{"values":{"no":29}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":19}},"CamelCase method name":{"values":{"yes":6}},"Function opening brace placement":{"values":{"new line":6}},"Spaces after control structure open parenthesis":{"values":[13]},"Spaces before control structure close parenthesis":{"values":[13]},"Blank lines at start of control structure":{"values":[15]},"Blank lines at end of control structure":{"values":[15]},"Control structure defined inline":{"values":{"no":12}},"PHP constant case":{"values":{"lower":8}}},"errorCount":1,"warningCount":0,"fixableCount":1,"numTokens":1094},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/ConditionInterface.php":{"hash":"26dcd5f24a9d92a35ad0c5385425c43833188","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":23}},"Line indent":{"values":{"spaces":12}},"PHP keyword case":{"values":{"lower":6}},"Multiple statements on same line":{"values":{"no":3}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"CamelCase method name":{"values":{"yes":2}},"PHP type case":{"values":{"lower":2}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":110},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/AndCondition.php":{"hash":"e69ce8ab29a2820cc1c8115a365cc47633188","errors":{"29":{"9":[{"message":"No blank line found after control structure","source":"Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose","listener":"PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\WhiteSpace\\ControlStructureSpacingSniff","severity":0,"fixable":true}]}},"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":28}},"Line indent":{"values":{"spaces":20}},"PHP keyword case":{"values":{"lower":15}},"Multiple statements on same line":{"values":{"no":7}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":3}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}},"Spaces after control structure open parenthesis":{"values":[2]},"Spaces before control structure close parenthesis":{"values":[2]},"Blank lines at start of control structure":{"values":[2]},"Blank lines at end of control structure":{"values":[2]},"Control structure defined inline":{"values":{"no":2}},"PHP constant case":{"values":{"lower":2}}},"errorCount":1,"warningCount":0,"fixableCount":1,"numTokens":200},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/NotCondition.php":{"hash":"ec181faf7a6ecb223ef9bbfa3faf8acc33188","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":21}},"Line indent":{"values":{"spaces":13}},"PHP keyword case":{"values":{"lower":10}},"Multiple statements on same line":{"values":{"no":5}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}},"PHP type case":{"values":{"lower":1}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":123},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/CachedCondition.php":{"hash":"e3969b8be705e14ac22e2084269c447833188","errors":{"31":{"13":[{"message":"Expected 0 spaces after opening bracket; newline found","source":"Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace","listener":"PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\WhiteSpace\\ControlStructureSpacingSniff","severity":0,"fixable":true}]}},"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":46}},"Line indent":{"values":{"spaces":38}},"PHP keyword case":{"values":{"lower":17}},"Multiple statements on same line":{"values":{"no":15}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":6}},"PHP constant case":{"values":{"lower":6}},"Function opening brace placement":{"values":{"new line":3}},"CamelCase method name":{"values":{"yes":2}},"Spaces after control structure open parenthesis":{"values":{"newline":1}},"Spaces before control structure close parenthesis":{"values":[1]},"Blank lines at start of control structure":{"values":[1]},"Blank lines at end of control structure":{"values":[1]},"Control structure defined inline":{"values":{"no":1}}},"errorCount":1,"warningCount":0,"fixableCount":1,"numTokens":325},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/CallableCondition.php":{"hash":"c7b1d160baceffa5b465a7a2de05781633188","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":27}},"Line indent":{"values":{"spaces":19}},"PHP keyword case":{"values":{"lower":14}},"Multiple statements on same line":{"values":{"no":7}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":5}},"Function opening brace placement":{"values":{"new line":3}},"CamelCase method name":{"values":{"yes":2}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":177},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/OrCondition.php":{"hash":"d7eac08ebf37debb12b9bf1ce122812133188","errors":{"29":{"9":[{"message":"No blank line found after control structure","source":"Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose","listener":"PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\WhiteSpace\\ControlStructureSpacingSniff","severity":0,"fixable":true}]}},"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":28}},"Line indent":{"values":{"spaces":20}},"PHP keyword case":{"values":{"lower":15}},"Multiple statements on same line":{"values":{"no":7}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":3}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}},"Spaces after control structure open parenthesis":{"values":[2]},"Spaces before control structure close parenthesis":{"values":[2]},"Blank lines at start of control structure":{"values":[2]},"Blank lines at end of control structure":{"values":[2]},"Control structure defined inline":{"values":{"no":2}},"PHP constant case":{"values":{"lower":2}}},"errorCount":1,"warningCount":0,"fixableCount":1,"numTokens":199},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/AbstractCondition.php":{"hash":"5fbfcbf346d3748b5231fcb1516bf57033188","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":20}},"Line indent":{"values":{"spaces":12}},"PHP keyword case":{"values":{"lower":10}},"Multiple statements on same line":{"values":{"no":4}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":3}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":111}} \ No newline at end of file +{"config":{"phpVersion":80227,"phpExtensions":"6444a8d24aa127a4fe13989038fc4447","tabWidth":4,"encoding":"utf-8","recordErrors":true,"annotations":true,"configData":[],"codeHash":"b5dc58ae9d1a395f86384fd9a1678bb4","rulesetHash":"670f8348153700c3a70fc6127ca0e484"},"\/home\/carlos\/Projects\/factory\/src\/Exceptions\/ClassNotFoundException.php":{"hash":"011861a2c1e73e741c9a3ebc26e25d6f33204","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":9,"81-120":2}},"PHP keyword case":{"values":{"lower":3}},"Multiple statements on same line":{"values":{"no":1}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":46},"\/home\/carlos\/Projects\/factory\/src\/Exceptions\/ServiceNotFoundException.php":{"hash":"00acc7052806f62a3929cdbe663c3fa533204","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":10,"81-120":1}},"PHP keyword case":{"values":{"lower":3}},"Multiple statements on same line":{"values":{"no":1}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":46},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/ConditionInterface.php":{"hash":"26dcd5f24a9d92a35ad0c5385425c43833188","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":23}},"Line indent":{"values":{"spaces":12}},"PHP keyword case":{"values":{"lower":6}},"Multiple statements on same line":{"values":{"no":3}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"CamelCase method name":{"values":{"yes":2}},"PHP type case":{"values":{"lower":2}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":110},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/AndCondition.php":{"hash":"e69ce8ab29a2820cc1c8115a365cc47633188","errors":{"29":{"9":[{"message":"No blank line found after control structure","source":"Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose","listener":"PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\WhiteSpace\\ControlStructureSpacingSniff","severity":0,"fixable":true}]}},"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":28}},"Line indent":{"values":{"spaces":20}},"PHP keyword case":{"values":{"lower":15}},"Multiple statements on same line":{"values":{"no":7}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":3}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}},"Spaces after control structure open parenthesis":{"values":[2]},"Spaces before control structure close parenthesis":{"values":[2]},"Blank lines at start of control structure":{"values":[2]},"Blank lines at end of control structure":{"values":[2]},"Control structure defined inline":{"values":{"no":2}},"PHP constant case":{"values":{"lower":2}}},"errorCount":1,"warningCount":0,"fixableCount":1,"numTokens":200},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/CachedCondition.php":{"hash":"e3969b8be705e14ac22e2084269c447833188","errors":{"31":{"13":[{"message":"Expected 0 spaces after opening bracket; newline found","source":"Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpenBrace","listener":"PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\WhiteSpace\\ControlStructureSpacingSniff","severity":0,"fixable":true}]}},"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":46}},"Line indent":{"values":{"spaces":38}},"PHP keyword case":{"values":{"lower":17}},"Multiple statements on same line":{"values":{"no":15}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":6}},"PHP constant case":{"values":{"lower":6}},"Function opening brace placement":{"values":{"new line":3}},"CamelCase method name":{"values":{"yes":2}},"Spaces after control structure open parenthesis":{"values":{"newline":1}},"Spaces before control structure close parenthesis":{"values":[1]},"Blank lines at start of control structure":{"values":[1]},"Blank lines at end of control structure":{"values":[1]},"Control structure defined inline":{"values":{"no":1}}},"errorCount":1,"warningCount":0,"fixableCount":1,"numTokens":325},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/NotCondition.php":{"hash":"ec181faf7a6ecb223ef9bbfa3faf8acc33188","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":21}},"Line indent":{"values":{"spaces":13}},"PHP keyword case":{"values":{"lower":10}},"Multiple statements on same line":{"values":{"no":5}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}},"PHP type case":{"values":{"lower":1}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":123},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/CallableCondition.php":{"hash":"c7b1d160baceffa5b465a7a2de05781633188","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":27}},"Line indent":{"values":{"spaces":19}},"PHP keyword case":{"values":{"lower":14}},"Multiple statements on same line":{"values":{"no":7}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":5}},"Function opening brace placement":{"values":{"new line":3}},"CamelCase method name":{"values":{"yes":2}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":177},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/XorCondition.php":{"hash":"35359a6d1e6b69c41c0a123afc49798133204","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":29}},"Line indent":{"values":{"spaces":21}},"PHP keyword case":{"values":{"lower":14}},"Multiple statements on same line":{"values":{"no":8}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":3}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}},"Spaces after control structure open parenthesis":{"values":[2]},"Spaces before control structure close parenthesis":{"values":[2]},"Blank lines at start of control structure":{"values":[2]},"Blank lines at end of control structure":{"values":[2]},"Control structure defined inline":{"values":{"no":2}},"Spacing between in\/decrementor and variable":{"values":[1]}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":212},"\/home\/carlos\/Projects\/factory\/src\/ServiceFactory.php":{"hash":"1d9cb1b08bc1d73bc5310cc458ebc0e733204","errors":{"160":{"13":[{"message":"No blank line found after control structure","source":"Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose","listener":"PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\WhiteSpace\\ControlStructureSpacingSniff","severity":0,"fixable":true}]}},"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":129,"81-120":17}},"Line indent":{"values":{"spaces":130}},"PHP keyword case":{"values":{"lower":70}},"Multiple statements on same line":{"values":{"no":29}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":19}},"CamelCase method name":{"values":{"yes":6}},"Function opening brace placement":{"values":{"new line":6}},"Spaces after control structure open parenthesis":{"values":[13]},"Spaces before control structure close parenthesis":{"values":[13]},"Blank lines at start of control structure":{"values":[15]},"Blank lines at end of control structure":{"values":[15]},"Control structure defined inline":{"values":{"no":12}},"PHP constant case":{"values":{"lower":8}}},"errorCount":1,"warningCount":0,"fixableCount":1,"numTokens":1094},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/OrCondition.php":{"hash":"d7eac08ebf37debb12b9bf1ce122812133188","errors":{"29":{"9":[{"message":"No blank line found after control structure","source":"Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose","listener":"PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\WhiteSpace\\ControlStructureSpacingSniff","severity":0,"fixable":true}]}},"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":28}},"Line indent":{"values":{"spaces":20}},"PHP keyword case":{"values":{"lower":15}},"Multiple statements on same line":{"values":{"no":7}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":3}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}},"Spaces after control structure open parenthesis":{"values":[2]},"Spaces before control structure close parenthesis":{"values":[2]},"Blank lines at start of control structure":{"values":[2]},"Blank lines at end of control structure":{"values":[2]},"Control structure defined inline":{"values":{"no":2}},"PHP constant case":{"values":{"lower":2}}},"errorCount":1,"warningCount":0,"fixableCount":1,"numTokens":199},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/NorCondition.php":{"hash":"20e5c7f02627add4fcaba8cd7de16d4b33204","errors":{"29":{"9":[{"message":"No blank line found after control structure","source":"Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose","listener":"PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\WhiteSpace\\ControlStructureSpacingSniff","severity":0,"fixable":true}]}},"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":28}},"Line indent":{"values":{"spaces":20}},"PHP keyword case":{"values":{"lower":15}},"Multiple statements on same line":{"values":{"no":7}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":3}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}},"Spaces after control structure open parenthesis":{"values":[2]},"Spaces before control structure close parenthesis":{"values":[2]},"Blank lines at start of control structure":{"values":[2]},"Blank lines at end of control structure":{"values":[2]},"Control structure defined inline":{"values":{"no":2}},"PHP constant case":{"values":{"lower":2}}},"errorCount":1,"warningCount":0,"fixableCount":1,"numTokens":199},"\/home\/carlos\/Projects\/factory\/src\/Conditions\/AbstractCondition.php":{"hash":"5fbfcbf346d3748b5231fcb1516bf57033188","errors":[],"warnings":[],"metrics":{"Declarations and side effects mixed":{"values":{"no":1}},"PHP short open tag used":{"values":{"no":1}},"EOL char":{"values":{"\\n":1}},"Number of newlines at EOF":{"values":{"1":1}},"PHP closing tag at end of PHP-only file":{"values":{"no":1}},"Line length":{"values":{"80 or less":20}},"Line indent":{"values":{"spaces":12}},"PHP keyword case":{"values":{"lower":10}},"Multiple statements on same line":{"values":{"no":4}},"One class per file":{"values":{"yes":1}},"Class defined in namespace":{"values":{"yes":1}},"PascalCase class name":{"values":{"yes":1}},"Class opening brace placement":{"values":{"new line":1}},"PHP type case":{"values":{"lower":3}},"Function opening brace placement":{"values":{"new line":2}},"CamelCase method name":{"values":{"yes":1}}},"errorCount":0,"warningCount":0,"fixableCount":0,"numTokens":111}} \ No newline at end of file diff --git a/src/Conditions/NorCondition.php b/src/Conditions/NorCondition.php new file mode 100644 index 0000000..9eaad0b --- /dev/null +++ b/src/Conditions/NorCondition.php @@ -0,0 +1,32 @@ + $c->getName(), $conditions); + parent::__construct('nor_' . implode('_', $names)); + $this->conditions = $conditions; + } + + public function evaluate(): bool + { + foreach ($this->conditions as $condition) { + if ($condition->evaluate()) { + return false; + } + } + return true; + } +} diff --git a/src/Conditions/XorCondition.php b/src/Conditions/XorCondition.php new file mode 100644 index 0000000..5cae87e --- /dev/null +++ b/src/Conditions/XorCondition.php @@ -0,0 +1,35 @@ + $c->getName(), $conditions); + parent::__construct('xor_' . implode('_', $names)); + $this->conditions = $conditions; + } + + public function evaluate(): bool + { + $trueCount = 0; + + foreach ($this->conditions as $condition) { + if ($condition->evaluate()) { + $trueCount++; + } + } + + return $trueCount === 1; + } +} diff --git a/tests/Conditions/LogicalConditionsTest.php b/tests/Conditions/LogicalConditionsTest.php new file mode 100644 index 0000000..ddb53c0 --- /dev/null +++ b/tests/Conditions/LogicalConditionsTest.php @@ -0,0 +1,100 @@ + $result); + } + + public function testNorCondition(): void + { + // Test with all false conditions (should return true) + $conditions = [ + $this->createTestCondition('false1', false), + $this->createTestCondition('false2', false), + $this->createTestCondition('false3', false) + ]; + $nor = new NorCondition($conditions); + $this->assertTrue($nor->evaluate(), 'NOR of all false conditions should be true'); + + // Test with one true condition (should return false) + $conditions = [ + $this->createTestCondition('false1', false), + $this->createTestCondition('true', true), + $this->createTestCondition('false2', false) + ]; + $nor = new NorCondition($conditions); + $this->assertFalse($nor->evaluate(), 'NOR with one true condition should be false'); + + // Test with all true conditions (should return false) + $conditions = [ + $this->createTestCondition('true1', true), + $this->createTestCondition('true2', true) + ]; + $nor = new NorCondition($conditions); + $this->assertFalse($nor->evaluate(), 'NOR of all true conditions should be false'); + + // Test with empty conditions (should return true) + $nor = new NorCondition([]); + $this->assertTrue($nor->evaluate(), 'NOR of empty conditions should be true'); + + // Test name generation + $conditions = [ + $this->createTestCondition('cond1', true), + $this->createTestCondition('cond2', false) + ]; + $nor = new NorCondition($conditions); + $this->assertEquals('nor_cond1_cond2', $nor->getName()); + } + + public function testXorCondition(): void + { + // Test with one true condition (should return true) + $conditions = [ + $this->createTestCondition('false1', false), + $this->createTestCondition('true', true), + $this->createTestCondition('false2', false) + ]; + $xor = new XorCondition($conditions); + $this->assertTrue($xor->evaluate(), 'XOR with exactly one true condition should be true'); + + // Test with multiple true conditions (should return false) + $conditions = [ + $this->createTestCondition('true1', true), + $this->createTestCondition('false', false), + $this->createTestCondition('true2', true) + ]; + $xor = new XorCondition($conditions); + $this->assertFalse($xor->evaluate(), 'XOR with multiple true conditions should be false'); + + // Test with all false conditions (should return false) + $conditions = [ + $this->createTestCondition('false1', false), + $this->createTestCondition('false2', false) + ]; + $xor = new XorCondition($conditions); + $this->assertFalse($xor->evaluate(), 'XOR of all false conditions should be false'); + + // Test with empty conditions (should return false) + $xor = new XorCondition([]); + $this->assertFalse($xor->evaluate(), 'XOR of empty conditions should be false'); + + // Test name generation + $conditions = [ + $this->createTestCondition('cond1', true), + $this->createTestCondition('cond2', false) + ]; + $xor = new XorCondition($conditions); + $this->assertEquals('xor_cond1_cond2', $xor->getName()); + } +}