Skip to content

Commit

Permalink
refactor: ConfigInterface is now SetupInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
devuri committed Mar 19, 2024
1 parent 164853c commit a478cfb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions src/Component/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Setup WP Config.
*/
class Setup implements ConfigInterface
class Setup implements SetupInterface
{
use ConfigTrait;
use ConstantBuilderTrait;
Expand Down Expand Up @@ -142,7 +142,7 @@ public static function init( string $app_path ): self
*
* @return self
*/
public function config( $environment = null, ?bool $setup = true ): ConfigInterface
public function config( $environment = null, ?bool $setup = true ): SetupInterface
{
// check required vars.
$this->is_required();
Expand Down Expand Up @@ -200,7 +200,7 @@ public function set_switcher( Switcher $switcher ): void
*
* @return static
*/
public function set_environment(): ConfigInterface
public function set_environment(): SetupInterface
{
if ( false === $this->environment && env( 'WP_ENVIRONMENT_TYPE' ) ) {
$this->define( 'WP_ENVIRONMENT_TYPE', env( 'WP_ENVIRONMENT_TYPE' ) );
Expand Down Expand Up @@ -260,7 +260,7 @@ public function get_environment(): string
*
* @return static
*/
public function set_error_handler( ?string $handler = null ): ConfigInterface
public function set_error_handler( ?string $handler = null ): SetupInterface
{
if ( ! $this->enable_error_handler() ) {
return $this;
Expand Down Expand Up @@ -296,7 +296,7 @@ public function set_error_handler( ?string $handler = null ): ConfigInterface
*
* @return static
*/
public function debug( $error_log_dir ): ConfigInterface
public function debug( $error_log_dir ): SetupInterface
{
if ( false === $this->environment && env( 'WP_ENVIRONMENT_TYPE' ) ) {
$this->reset_environment( env( 'WP_ENVIRONMENT_TYPE' ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace WPframework\Component;

interface ConfigInterface
interface SetupInterface
{
/**
* Runs config setup.
Expand Down
18 changes: 9 additions & 9 deletions src/Component/Traits/ConfigTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace WPframework\Component\Traits;

use WPframework\Component\ConfigInterface;
use WPframework\Component\SetupInterface;

trait ConfigTrait
{
Expand All @@ -11,7 +11,7 @@ trait ConfigTrait
*
* @return static
*/
public function site_url(): ConfigInterface
public function site_url(): SetupInterface
{
$this->define( 'WP_HOME', env( 'WP_HOME' ) );
$this->define( 'WP_SITEURL', env( 'WP_SITEURL' ) );
Expand All @@ -24,7 +24,7 @@ public function site_url(): ConfigInterface
*
* @return static
*/
public function assetUrl(): ConfigInterface
public function assetUrl(): SetupInterface
{
$this->define( 'ASSET_URL', env( 'ASSET_URL' ) );

Expand All @@ -36,7 +36,7 @@ public function assetUrl(): ConfigInterface
*
* @return static
*/
public function optimize(): ConfigInterface
public function optimize(): SetupInterface
{
$this->define( 'CONCATENATE_SCRIPTS', env( 'CONCATENATE_SCRIPTS' ) ?? self::const( 'optimize' ) );

Expand All @@ -48,7 +48,7 @@ public function optimize(): ConfigInterface
*
* @return static
*/
public function memory(): ConfigInterface
public function memory(): SetupInterface
{
$this->define( 'WP_MEMORY_LIMIT', env( 'MEMORY_LIMIT' ) ?? self::const( 'memory' ) );
$this->define( 'WP_MAX_MEMORY_LIMIT', env( 'MAX_MEMORY_LIMIT' ) ?? self::const( 'memory' ) );
Expand All @@ -61,7 +61,7 @@ public function memory(): ConfigInterface
*
* @return static
*/
public function force_ssl(): ConfigInterface
public function force_ssl(): SetupInterface
{
$this->define( 'FORCE_SSL_ADMIN', env( 'FORCE_SSL_ADMIN' ) ?? self::const( 'ssl_admin' ) );
$this->define( 'FORCE_SSL_LOGIN', env( 'FORCE_SSL_LOGIN' ) ?? self::const( 'ssl_login' ) );
Expand All @@ -74,7 +74,7 @@ public function force_ssl(): ConfigInterface
*
* @return static
*/
public function autosave(): ConfigInterface
public function autosave(): SetupInterface
{
$this->define( 'AUTOSAVE_INTERVAL', env( 'AUTOSAVE_INTERVAL' ) ?? self::const( 'autosave' ) );
$this->define( 'WP_POST_REVISIONS', env( 'WP_POST_REVISIONS' ) ?? self::const( 'revisions' ) );
Expand All @@ -87,7 +87,7 @@ public function autosave(): ConfigInterface
*
* @return static
*/
public function database(): ConfigInterface
public function database(): SetupInterface
{
$this->define( 'DB_NAME', env( 'DB_NAME' ) );
$this->define( 'DB_USER', env( 'DB_USER' ) );
Expand All @@ -105,7 +105,7 @@ public function database(): ConfigInterface
*
* @return static
*/
public function salts(): ConfigInterface
public function salts(): SetupInterface
{
$this->define( 'AUTH_KEY', env( 'AUTH_KEY' ) );
$this->define( 'SECURE_AUTH_KEY', env( 'SECURE_AUTH_KEY' ) );
Expand Down

0 comments on commit a478cfb

Please sign in to comment.