-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Introduces has_middleware method. * Adds check ot make it possible to skip event logging for a registry * Bumps logger version * Introduces registry factory
- Loading branch information
1 parent
fe58799
commit 926cb0a
Showing
4 changed files
with
93 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Underpin\Factories; | ||
|
||
|
||
use Underpin\Traits\Instance_Setter; | ||
use WP_Error; | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
class Registry extends \Underpin\Abstracts\Registries\Registry { | ||
|
||
use Instance_Setter; | ||
|
||
protected $default_items = []; | ||
|
||
protected $validate_callback; | ||
|
||
public function __construct( $args ) { | ||
$registry_id = $args['registry_id']; | ||
$this->set_values( $args ); | ||
parent::__construct( $registry_id ); | ||
} | ||
|
||
protected function set_default_items() { | ||
foreach ( $this->default_items as $key => $value ) { | ||
$this->add( $key, $value ); | ||
} | ||
|
||
unset( $this->default_items ); | ||
} | ||
|
||
protected function validate_item( $key, $value ) { | ||
return $this->set_callable( $this->validate_callback, $key, $value ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters