From bf7586c858658040bd6d3a6da09587c34070b5e9 Mon Sep 17 00:00:00 2001 From: onigra <3280467rec@gmail.com> Date: Sat, 11 Feb 2017 20:44:13 +0900 Subject: [PATCH] DRY @run options --- src/beautifiers/php-cs-fixer.coffee | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/beautifiers/php-cs-fixer.coffee b/src/beautifiers/php-cs-fixer.coffee index 0b8ec16..c6b1b4a 100644 --- a/src/beautifiers/php-cs-fixer.coffee +++ b/src/beautifiers/php-cs-fixer.coffee @@ -18,6 +18,12 @@ module.exports = class PHPCSFixer extends Beautifier @debug('php-cs-fixer', options) configFile = if context? and context.filePath? then @findFile(path.dirname(context.filePath), '.php_cs') + runOptions = { + ignoreReturnCode: true + help: { + link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer" + } + } # Find php-cs-fixer.phar script @Promise.all([ @@ -42,12 +48,7 @@ module.exports = class PHPCSFixer extends Beautifier "--fixers=#{options.fixers}" if options.fixers "--config-file=#{configFile}" if configFile tempFile = @tempFile("temp", text) - ], { - ignoreReturnCode: true - help: { - link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer" - } - }) + ], runOptions) .then(=> @readFile(tempFile) ) @@ -58,12 +59,7 @@ module.exports = class PHPCSFixer extends Beautifier "--fixers=#{options.fixers}" if options.fixers "--config-file=#{configFile}" if configFile tempFile = @tempFile("temp", text) - ], { - ignoreReturnCode: true - help: { - link: "https://github.com/FriendsOfPHP/PHP-CS-Fixer" - } - }) + ], runOptions) .then(=> @readFile(tempFile) )