@@ -21,17 +21,17 @@ public function __construct(\Docopt|DocoptDoubleInterface $parser)
2121 $ this ->defaultFormat = 'stylish ' ;
2222
2323 $ filename = __DIR__ . "/../../docopt.txt " ;
24- if (file_exists ($ filename )) {
25- $ handler = fopen ($ filename , 'r ' );
24+ if (
25+ file_exists ($ filename ) &&
26+ ($ handler = fopen ($ filename , 'r ' ))
27+ ) {
2628 $ filesize = filesize ($ filename );
27- if ($ handler !== false ) {
28- $ fileData = fread (
29- $ handler ,
30- ($ filesize !== false ) ? max (1 , $ filesize ) : 1
31- );
32- $ this ->parserDescriptor = is_string ($ fileData ) ? $ fileData : "" ;
33- fclose ($ handler );
34- }
29+ $ fileData = fread (
30+ $ handler ,
31+ max (1 , $ filesize )
32+ );
33+ $ this ->parserDescriptor = is_string ($ fileData ) ? $ fileData : "" ;
34+ fclose ($ handler );
3535 }
3636 }
3737
@@ -41,12 +41,10 @@ public function execute(CommandLineParserInterface $command): CommandLineParserI
4141 * @var \Docopt\Response|DocoptDoubleInterface $objArgs
4242 */
4343 $ objArgs = $ this ->parser ->handle ($ this ->parserDescriptor , array ('version ' => '1.0.6 ' ));
44- if (isset ($ objArgs ->args )) {
45- if (is_array ($ objArgs ->args )) {
46- foreach ($ objArgs ->args as $ key => $ value ) {
47- if (is_string ($ key )) {
48- $ this ->args [$ key ] = is_string ($ value ) ? $ value : "" ;
49- }
44+ if (isset ($ objArgs ->args ) && is_array ($ objArgs ->args )) {
45+ foreach ($ objArgs ->args as $ key => $ value ) {
46+ if (is_string ($ key )) {
47+ $ this ->args [$ key ] = is_string ($ value ) ? $ value : "" ;
5048 }
5149 }
5250 } else {
0 commit comments