-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEBUG ONLY: Revert "drop FactoryTrait"
This reverts commit a7c8190.
- Loading branch information
Showing
4 changed files
with
61 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace atk4\core; | ||
|
||
trait FactoryTrait | ||
{ | ||
/** | ||
* Check this property to see if trait is present in the object. | ||
* | ||
* @var bool | ||
*/ | ||
public $_factoryTrait = true; | ||
|
||
/** | ||
* See \atk4\core\Factory::mergeSeeds(). | ||
*/ | ||
public function mergeSeeds($seed, $seed2, ...$more_seeds) | ||
{ | ||
return GlobalInternal::getDefaultFactory()->mergeSeeds($seed, $seed2, $more_seeds); | ||
} | ||
|
||
/** | ||
* See \atk4\core\Factory::factory(). | ||
*/ | ||
public function factory($seed, $defaults = []): object | ||
{ | ||
return GlobalInternal::getDefaultFactory()->factory($seed, $defaults); | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace atk4\core; | ||
|
||
class GlobalInternal | ||
{ | ||
/** @var Factory */ | ||
private static $_defaultFactory; | ||
|
||
private function __construct() | ||
{ | ||
// zeroton | ||
} | ||
|
||
/** | ||
* @return FactoryTrait | ||
*/ | ||
public static function getDefaultFactory() | ||
{ | ||
if (self::$_defaultFactory === null) { | ||
self::$_defaultFactory = new Factory(); | ||
} | ||
|
||
return self::$_defaultFactory; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.