From: Christian Weiske Date: Wed, 14 Sep 2016 19:28:44 +0000 (+0200) Subject: move constructor to command base class X-Git-Tag: v0.0.6~6 X-Git-Url: https://git.cweiske.de/shpub.git/commitdiff_plain/f46e4d3108d944bcf86f5905780f1fcfd441c036 move constructor to command base class --- diff --git a/src/shpub/Command/AbstractProps.php b/src/shpub/Command/AbstractProps.php index 08dbc97..6d7ef3b 100644 --- a/src/shpub/Command/AbstractProps.php +++ b/src/shpub/Command/AbstractProps.php @@ -6,6 +6,16 @@ namespace shpub; */ class Command_AbstractProps { + /** + * @var Config + */ + protected $cfg; + + public function __construct($cfg) + { + $this->cfg = $cfg; + } + public static function optsGeneric(\Console_CommandLine_Command $cmd) { $cmd->addOption( diff --git a/src/shpub/Command/Article.php b/src/shpub/Command/Article.php index b51740d..9f40daf 100644 --- a/src/shpub/Command/Article.php +++ b/src/shpub/Command/Article.php @@ -3,16 +3,6 @@ namespace shpub; class Command_Article extends Command_AbstractProps { - /** - * @var Config - */ - protected $cfg; - - public function __construct($cfg) - { - $this->cfg = $cfg; - } - public static function opts(\Console_CommandLine $optParser) { $cmd = $optParser->addCommand('article'); diff --git a/src/shpub/Command/Delete.php b/src/shpub/Command/Delete.php index fec839f..a13775a 100644 --- a/src/shpub/Command/Delete.php +++ b/src/shpub/Command/Delete.php @@ -3,16 +3,6 @@ namespace shpub; class Command_Delete extends Command_AbstractProps { - /** - * @var Config - */ - protected $cfg; - - public function __construct($cfg) - { - $this->cfg = $cfg; - } - public static function opts(\Console_CommandLine $optParser) { $cmd = $optParser->addCommand('delete'); diff --git a/src/shpub/Command/Like.php b/src/shpub/Command/Like.php index 5b456f9..65020dc 100644 --- a/src/shpub/Command/Like.php +++ b/src/shpub/Command/Like.php @@ -3,16 +3,6 @@ namespace shpub; class Command_Like extends Command_AbstractProps { - /** - * @var Config - */ - protected $cfg; - - public function __construct($cfg) - { - $this->cfg = $cfg; - } - public static function opts(\Console_CommandLine $optParser) { $cmd = $optParser->addCommand('like'); diff --git a/src/shpub/Command/Note.php b/src/shpub/Command/Note.php index 1ea599b..2e07e9d 100644 --- a/src/shpub/Command/Note.php +++ b/src/shpub/Command/Note.php @@ -3,16 +3,6 @@ namespace shpub; class Command_Note extends Command_AbstractProps { - /** - * @var Config - */ - protected $cfg; - - public function __construct($cfg) - { - $this->cfg = $cfg; - } - public static function opts(\Console_CommandLine $optParser) { $cmd = $optParser->addCommand('note'); diff --git a/src/shpub/Command/Reply.php b/src/shpub/Command/Reply.php index b67d46b..493d587 100644 --- a/src/shpub/Command/Reply.php +++ b/src/shpub/Command/Reply.php @@ -3,16 +3,6 @@ namespace shpub; class Command_Reply extends Command_AbstractProps { - /** - * @var Config - */ - protected $cfg; - - public function __construct($cfg) - { - $this->cfg = $cfg; - } - public static function opts(\Console_CommandLine $optParser) { $cmd = $optParser->addCommand('reply'); diff --git a/src/shpub/Command/Repost.php b/src/shpub/Command/Repost.php index 2f4b46f..3c39178 100644 --- a/src/shpub/Command/Repost.php +++ b/src/shpub/Command/Repost.php @@ -3,16 +3,6 @@ namespace shpub; class Command_Repost extends Command_AbstractProps { - /** - * @var Config - */ - protected $cfg; - - public function __construct($cfg) - { - $this->cfg = $cfg; - } - public static function opts(\Console_CommandLine $optParser) { $cmd = $optParser->addCommand('repost');