Skip to content

Commit

Permalink
GREAT RENAMING OF CLASSES
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Jun 6, 2015
1 parent cd045eb commit 3091450
Show file tree
Hide file tree
Showing 35 changed files with 72 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .hidev/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
parentConfig:
parent:
github: hiqdev/hidev-config

package:
Expand Down
3 changes: 1 addition & 2 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ ROADMAP
-------

Nearest - 0.1.0 release:
- changelog build from commits
- great renaming
- great renaming of classes
- plugin architecture
- php-cs-fixer plugin
- phpunit plugin
Expand Down
2 changes: 1 addition & 1 deletion components/Application.php → base/Application.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace hidev\components;
namespace hidev\base;

use Yii;
use yii\base\ViewContextInterface;
Expand Down
4 changes: 2 additions & 2 deletions components/File.php → base/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @copyright Copyright (c) 2015 HiQDev
*/

namespace hidev\components;
namespace hidev\base;

use Yii;
use yii\base\Arrayable;
Expand Down Expand Up @@ -198,7 +198,7 @@ public function getHandler()
{
if (!is_object($this->_handler)) {
$this->_handler = Yii::createObject([
'class' => 'hidev\handlers\\' . $this->getCtype(),
'class' => 'hidev\handlers\\' . $this->getCtype() . 'Handler',
'template' => $this->template,
'goal' => $this->goal,
]);
Expand Down
4 changes: 1 addition & 3 deletions components/History.php → base/History.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
* @copyright Copyright (c) 2015 HiQDev
*/

namespace hidev\components;

use Yii;
namespace hidev\base;

/**
* Handler for commits history
Expand Down
3 changes: 1 addition & 2 deletions components/Logger.php → base/Logger.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

namespace hidev\components;
namespace hidev\base;

use Yii;
use yii\helpers\Console;

/**
Expand Down
4 changes: 2 additions & 2 deletions components/Request.php → base/Request.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace hidev\components;
namespace hidev\base;

use Yii;
use hidev\controllers\DefaultController;
Expand Down Expand Up @@ -33,7 +33,7 @@ public function getParams()
if ($alias) {
array_shift($args);
$args = array_merge($alias, $args);
}
}
$action = $args[0];
if (Yii::$app->config->hasItem($action)) {
array_shift($args);
Expand Down
2 changes: 1 addition & 1 deletion components/View.php → base/View.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace hidev\components;
namespace hidev\base;

use Yii;

Expand Down
2 changes: 1 addition & 1 deletion goals/Aliases.php → goals/AliasesGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Yii;
use hidev\helpers\Helper;

class Aliases extends \hiqdev\collection\Object
class AliasesGoal extends \hiqdev\collection\Object
{
public $name;

Expand Down
4 changes: 1 addition & 3 deletions goals/Author.php → goals/AuthorGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

namespace hidev\goals;

use Yii;

/**
* Authors for the config.
*/
class Author extends \hiqdev\collection\Model
class AuthorGoal extends \hiqdev\collection\Model
{
public function rules()
{
Expand Down
2 changes: 1 addition & 1 deletion goals/Base.php → goals/BaseGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Default Goal. 'default' is reserved that's why Base
*/
class Base extends \hiqdev\collection\Manager implements \hiqdev\collection\ItemWithNameInterface
class BaseGoal extends \hiqdev\collection\Manager implements \hiqdev\collection\ItemWithNameInterface
{

protected $_itemClass = 'hiqdev\collection\Manager';
Expand Down
4 changes: 1 addition & 3 deletions goals/Changelog.php → goals/ChangelogGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

namespace hidev\goals;

use Yii;

/**
* Goal for README
*/
class Changelog extends Template
class ChangelogGoal extends TemplateGoal
{
protected $_fileType = 'changelog';

Expand Down
4 changes: 1 addition & 3 deletions goals/Commits.php → goals/CommitsGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

namespace hidev\goals;

use Yii;

/**
* Goal for reading and writing commits history to build CHANGELOG.md
*/
class Commits extends File
class CommitsGoal extends FileGoal
{
/**
* @inheritdoc
Expand Down
4 changes: 1 addition & 3 deletions goals/Composer.php → goals/ComposerGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

namespace hidev\goals;

use Yii;

/**
* Goal for Composer
*/
class Composer extends Base
class ComposerGoal extends BaseGoal
{
public function init()
{
Expand Down
3 changes: 1 addition & 2 deletions goals/ComposerJson.php → goals/ComposerJsonGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@

namespace hidev\goals;

use Yii;
use hiqdev\collection\Manager;

/**
* Goal for composer.json
*/
class ComposerJson extends Template
class ComposerJsonGoal extends TemplateGoal
{
protected $_file = 'composer.json';

Expand Down
6 changes: 3 additions & 3 deletions goals/Config.php → goals/ConfigGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* The Config. Keeps the Goals.
*/
class Config extends File implements BootstrapInterface
class ConfigGoal extends FileGoal implements BootstrapInterface
{
/**
* @var array|File file with main config
Expand All @@ -46,7 +46,7 @@ public static function goal2class($id, $name = null)
{
$id = $id ?: static::$_knownGoals[$name] ?: $name;

return 'hidev\goals\\' . Helper::id2camel($id);
return 'hidev\goals\\' . Helper::id2camel($id) . 'Goal';
}

public function getItemClass($name = null, array $config = [])
Expand Down Expand Up @@ -79,7 +79,7 @@ public function bootstrap($app)
Yii::setAlias('@config', '@source/' . $this->dirname);
Yii::setAlias('@parent', '@config/parent');
$this->load();
$parent = $this->parentConfig;
$parent = $this->parent;
if ($parent->defined) {
if (!$parent->file->find($this->types)) {
throw new InvalidParamException('No parent config found at ' . $parent->defined);
Expand Down
14 changes: 7 additions & 7 deletions goals/File.php → goals/FileGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
namespace hidev\goals;

use Yii;
use hidev\components\File as FileComponent;
use hidev\base\File;
use hidev\helpers\Helper;

/**
* A File Goal.
*/
class File extends Base
class FileGoal extends BaseGoal
{

/**
Expand All @@ -42,7 +42,7 @@ public function getTemplate()
* Returns file object.
* Instantiates it if necessary.
*
* @return FileComponent
* @return File
*/
public function getFile()
{
Expand All @@ -53,7 +53,7 @@ public function getFile()
];
}
$this->_file = Yii::createObject(array_merge([
'class' => FileComponent::className(),
'class' => File::className(),
'template' => $this->getTemplate(),
'goal' => $this,
], $this->_file));
Expand All @@ -65,7 +65,7 @@ public function getFile()
/**
* Sets file with given info.
*
* @param mixed $info could be anything that is good for FileComponent::create
* @param mixed $info could be anything that is good for File::create
*/
public function setFile($info)
{
Expand All @@ -84,7 +84,7 @@ public function getPath()

static public function exists($path)
{
return FileComponent::exists($path);
return File::exists($path);
}

public function read()
Expand All @@ -99,7 +99,7 @@ public function readArray()

public function load()
{
$this->mset($this->getFile()->load());
$this->mset($this->getFile()->load() ?: []);
}

public function save()
Expand Down
2 changes: 1 addition & 1 deletion goals/Git.php → goals/GitGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Goal for Git
*/
class Git extends Vcs
class GitGoal extends VcsGoal
{
/**
* @inheritdoc
Expand Down
6 changes: 2 additions & 4 deletions goals/Gitignore.php → goals/GitignoreGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@

namespace hidev\goals;

use Yii;

/**
* Goal for LICENSE
* Goal for .gitignore
*/
class Gitignore extends Template
class GitignoreGoal extends TemplateGoal
{
}
3 changes: 1 addition & 2 deletions goals/License.php → goals/LicenseGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@

namespace hidev\goals;

use Yii;
use hidev\helpers\Helper;

/**
* Goal for LICENSE
*/
class License extends Template
class LicenseGoal extends TemplateGoal
{
public function getTemplate()
{
Expand Down
3 changes: 1 addition & 2 deletions goals/Package.php → goals/PackageGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@

namespace hidev\goals;

use Yii;
use hidev\helpers\Helper;

/**
* Package part of the config.
*/
class Package extends Vendor
class PackageGoal extends VendorGoal
{
public function rules()
{
Expand Down
7 changes: 3 additions & 4 deletions goals/ParentConfig.php → goals/ParentGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@

namespace hidev\goals;

use Yii;
use yii\base\InvalidParamException;
use hidev\helpers\Helper;

/**
* The Config. Keeps the Goals.
*/
class ParentConfig extends File
class ParentGoal extends FileGoal
{
use \Robo\Task\Vcs\loadTasks;

public $name;

protected $_file = '@parent/config.json';
protected $_file = '@parent/config.yml';

protected $_defined;

Expand All @@ -37,7 +36,7 @@ public function setGithub($github)
}
$this->_github = $github;
$this->_defined = 'github:' . $github;
if (File::exists($this->file->dirname)) {
if (static::exists($this->file->dirname)) {
return;
}
$task = $this->taskGitStack()
Expand Down
4 changes: 1 addition & 3 deletions goals/Readme.php → goals/ReadmeGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

namespace hidev\goals;

use Yii;

/**
* Goal for README
*/
class Readme extends Template
class ReadmeGoal extends TemplateGoal
{
public function getTemplate()
{
Expand Down
2 changes: 1 addition & 1 deletion goals/Robo.php → goals/RoboGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace hidev\goals;

class Robo extends \Robo\Tasks
class RoboGoal extends \Robo\Tasks
{

}
4 changes: 1 addition & 3 deletions goals/Template.php → goals/TemplateGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@

namespace hidev\goals;

use Yii;

/**
* Goal for templated files.
*/
class Template extends File
class TemplateGoal extends FileGoal
{
}
2 changes: 1 addition & 1 deletion goals/Vcs.php → goals/VcsGoal.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Goal for VCS (Version Control Systems).
*/
class Vcs extends Base
class VcsGoal extends BaseGoal
{
public $lastTag = 'Under development';

Expand Down
Loading

0 comments on commit 3091450

Please sign in to comment.