Skip to content

Commit

Permalink
2.0 wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nateiler committed Jan 10, 2019
1 parent 2c76d99 commit 35dfd08
Show file tree
Hide file tree
Showing 26 changed files with 930 additions and 1,281 deletions.
26 changes: 10 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flipboxfactory/craft-domains",
"version": "1.1.1",
"version": "2.0.0",
"description": "Element domains",
"type": "craft-plugin",
"keywords": [
Expand All @@ -10,8 +10,7 @@
],
"require": {
"craftcms/cms": "^3.0",
"flipboxfactory/craft-ember": "^1.0.1",
"flipboxfactory/craft-sortable-associations": "^1.0"
"flipboxfactory/craft-ember": "^2.0.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0",
Expand All @@ -20,12 +19,12 @@
},
"autoload": {
"psr-4": {
"flipbox\\domains\\": "src/"
"flipbox\\craft\\domains\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"flipbox\\domains\\tests\\": "tests/src/"
"flipbox\\craft\\domains\\tests\\": "tests/src/"
}
},
"license": "MIT",
Expand All @@ -37,22 +36,17 @@
],
"support": {
"email": "support@flipboxdigital.com",
"issues": "https://github.com/flipboxfactory/domains/issues?state=open",
"source": "https://github.com/flipboxfactory/domains",
"docs": "https://github.com/flipboxfactory/domains",
"rss": "https://github.com/flipboxfactory/domains/commits/master.atom"
"issues": "https://github.com/flipboxfactory/craft-domains/issues?state=open",
"source": "https://github.com/flipboxfactory/craft-domains",
"docs": "https://github.com/flipboxfactory/craft-domains",
"rss": "https://github.com/flipboxfactory/craft-domains/commits/master.atom"
},
"extra": {
"name": "Domains",
"handle": "domains",
"class": "flipbox\\domains\\Domains",
"class": "flipbox\\craft\\domains\\Domains",
"hasCpSettings": false,
"hasCpSection": false,
"schemaVersion": "1.0.0",
"components": {
"fields": "flipbox\\domains\\services\\Fields",
"domains": "flipbox\\domains\\services\\Domains",
"associations": "flipbox\\domains\\services\\Associations"
}
"schemaVersion": "1.0.0"
}
}
96 changes: 7 additions & 89 deletions src/Domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@
* @link https://www.flipboxfactory.com/software/domains/
*/

namespace flipbox\domains;
namespace flipbox\craft\domains;

use Craft;
use craft\base\Plugin as BasePlugin;
use craft\events\RegisterComponentTypesEvent;
use craft\services\Fields;
use flipbox\domains\fields\Domains as DomainsField;
use flipbox\craft\ember\modules\LoggerTrait;
use flipbox\craft\domains\fields\Domains as DomainsField;
use yii\base\Event;
use yii\log\Logger;

/**
* @author Flipbox Factory <hello@flipboxfactory.com>
* @since 1.0.0
*/
class Domains extends BasePlugin
{
use LoggerTrait;

/**
* @inheritdoc
*/
Expand All @@ -41,93 +42,10 @@ function (RegisterComponentTypesEvent $event) {
}

/**
* @return services\Fields
*/
public function getFields()
{
return $this->get('fields');
}

/**
* @return services\Domains
*/
public function getDomains()
{
return $this->get('domains');
}

/**
* @return services\Associations
*/
public function getAssociations()
{
return $this->get('associations');
}

/*******************************************
* LOGGING
*******************************************/

/**
* Logs a trace message.
* Trace messages are logged mainly for development purpose to see
* the execution work flow of some code.
* @param string $message the message to be logged.
* @param string $category the category of the message.
*/
public static function trace($message, string $category = null)
{
Craft::getLogger()->log($message, Logger::LEVEL_TRACE, self::normalizeCategory($category));
}

/**
* Logs an error message.
* An error message is typically logged when an unrecoverable error occurs
* during the execution of an application.
* @param string $message the message to be logged.
* @param string $category the category of the message.
*/
public static function error($message, string $category = null)
{
Craft::getLogger()->log($message, Logger::LEVEL_ERROR, self::normalizeCategory($category));
}

/**
* Logs a warning message.
* A warning message is typically logged when an error occurs while the execution
* can still continue.
* @param string $message the message to be logged.
* @param string $category the category of the message.
*/
public static function warning($message, string $category = null)
{
Craft::getLogger()->log($message, Logger::LEVEL_WARNING, self::normalizeCategory($category));
}

/**
* Logs an informative message.
* An informative message is typically logged by an application to keep record of
* something important (e.g. an administrator logs in).
* @param string $message the message to be logged.
* @param string $category the category of the message.
*/
public static function info($message, string $category = null)
{
Craft::getLogger()->log($message, Logger::LEVEL_INFO, self::normalizeCategory($category));
}

/**
* @param string|null $category
* @return string
*/
private static function normalizeCategory(string $category = null)
protected static function getLogFileName(): string
{
$normalizedCategory = 'Domains';

if ($category === null) {
return $normalizedCategory;
}

return $normalizedCategory . ': ' . $category;
return 'domains';
}
}
98 changes: 0 additions & 98 deletions src/actions/Action.php

This file was deleted.

30 changes: 0 additions & 30 deletions src/actions/Associate.php

This file was deleted.

0 comments on commit 35dfd08

Please sign in to comment.