Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code structure #12

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/Mailhog_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@


use EE\Model\Site;
use function EE\Site\Utils\auto_site_name;
use EE\Site\Utils as Site_Utils;
use EE\Auth\Utils as Auth_Utils;
use EE\Utils as EE_Utils;

/**
* Manages mailhog on a site.
Expand Down Expand Up @@ -35,12 +37,12 @@ class Mailhog_Command extends EE_Command {
*/
public function enable( $args, $assoc_args ) {

\EE\Auth\Utils\init_global_admin_tools_auth();
Auth_Utils\init_global_admin_tools_auth();

EE\Utils\delem_log( 'mailhog' . __FUNCTION__ . ' start' );
$args = auto_site_name( $args, 'mailhog', __FUNCTION__ );
$force = EE\Utils\get_flag_value( $assoc_args, 'force' );
$this->site_data = Site::find( EE\Utils\remove_trailing_slash( $args[0] ) );
EE_Utils\delem_log( 'mailhog' . __FUNCTION__ . ' start' );
$args = Site_Utils\auto_site_name( $args, 'mailhog', __FUNCTION__ );
$force = EE_Utils\get_flag_value( $assoc_args, 'force' );
$this->site_data = Site::find( EE_Utils\remove_trailing_slash( $args[0] ) );
if ( ! $this->site_data || ! $this->site_data->site_enabled ) {
EE::error( sprintf( 'Site %s does not exist / is not enabled.', $args[0] ) );
}
Expand Down Expand Up @@ -74,9 +76,9 @@ public function enable( $args, $assoc_args ) {
*/
public function disable( $args, $assoc_args ) {

EE\Utils\delem_log( 'mailhog' . __FUNCTION__ . ' start' );
$args = auto_site_name( $args, 'mailhog', __FUNCTION__ );
$this->site_data = Site::find( EE\Utils\remove_trailing_slash( $args[0] ) );
EE_Utils\delem_log( 'mailhog' . __FUNCTION__ . ' start' );
$args = Site_Utils\auto_site_name( $args, 'mailhog', __FUNCTION__ );
$this->site_data = Site::find( EE_Utils\remove_trailing_slash( $args[0] ) );
if ( ! $this->site_data || ! $this->site_data->site_enabled ) {
EE::error( sprintf( 'Site %s does not exist / is not enabled.', $args[0] ) );
}
Expand Down Expand Up @@ -110,9 +112,9 @@ public function disable( $args, $assoc_args ) {
*/
public function status( $args, $assoc_args ) {

EE\Utils\delem_log( 'mailhog' . __FUNCTION__ . ' start' );
$args = auto_site_name( $args, 'mailhog', __FUNCTION__ );
$this->site_data = Site::find( EE\Utils\remove_trailing_slash( $args[0] ) );
EE_Utils\delem_log( 'mailhog' . __FUNCTION__ . ' start' );
$args = Site_Utils\auto_site_name( $args, 'mailhog', __FUNCTION__ );
$this->site_data = Site::find( EE_Utils\remove_trailing_slash( $args[0] ) );
if ( ! $this->site_data || ! $this->site_data->site_enabled ) {
EE::error( sprintf( 'Site %s does not exist / is not enabled.', $args[0] ) );
}
Expand Down