MediaWiki master
Wikimedia\Leximorph\Traits Namespace Reference

Variables

 $args = $this->getSpecArgs( $spec, $logger )
 
return $cached
 
 $instance = ObjectFactory::getObjectFromSpec( $objectSpec )
 
LoggerInterface $logger = null
 The logger instance.
 
if(!empty( $spec['args']) &&is_array( $spec['args'])) $objectSpec
 
if(!isset( $specs[$class])) $spec = $specs[$class]
 
 $specs = $this->getSpecMap()
 
array array< string, $singletons=[];abstract protected function getSpecMap():array;abstract protected function getSpecArgs(array $spec, LoggerInterface $logger):array;protected function createFromSpec(string $class) { if(isset($this->singletons[ $class])) { $cached=$this-> singletons [$class]
 Cache of created singleton objects.
 
if(! $instance instanceof $class) $this singletons [$class] = $instance
 
trait SpecBasedFactoryTrait
 SpecBasedFactoryTrait.
 

Variable Documentation

◆ $args

Wikimedia::Leximorph::Traits\$args = $this->getSpecArgs( $spec, $logger )

Definition at line 88 of file SpecBasedFactoryTrait.php.

◆ $cached

return Wikimedia::Leximorph::Traits\$cached

Definition at line 77 of file SpecBasedFactoryTrait.php.

◆ $instance

return Wikimedia::Leximorph::Traits::$instance = ObjectFactory::getObjectFromSpec( $objectSpec )

Definition at line 98 of file SpecBasedFactoryTrait.php.

◆ $logger

Wikimedia::Leximorph::Traits\$logger = null
protected

The logger instance.

Definition at line 33 of file SpecBasedFactoryTrait.php.

◆ $objectSpec

if (!empty($spec[ 'args']) &&is_array($spec[ 'args'])) Wikimedia::Leximorph::Traits\$objectSpec
Initial value:
= [
'class' => $class,
'args' => $args,
]

Definition at line 93 of file SpecBasedFactoryTrait.php.

◆ $spec

if (!isset($specs[ $class])) Wikimedia::Leximorph::Traits\$spec = $specs[$class]

Definition at line 85 of file SpecBasedFactoryTrait.php.

◆ $specs

Wikimedia::Leximorph::Traits\$specs = $this->getSpecMap()

Definition at line 80 of file SpecBasedFactoryTrait.php.

◆ singletons [1/2]

array array<string, $singletons = []; abstract protected function getSpecMap(): array; abstract protected function getSpecArgs( array $spec, LoggerInterface $logger ): array; protected function createFromSpec( string $class ) { if ( isset( $this->singletons[$class] ) ) { $cached = $this-> Wikimedia::Leximorph::Traits\singletons[ $class]
protected

Cache of created singleton objects.

object>

Definition at line 75 of file SpecBasedFactoryTrait.php.

◆ singletons [2/2]

if (! $instance instanceof $class) $this Wikimedia::Leximorph::Traits\singletons[ $class] = $instance

Definition at line 106 of file SpecBasedFactoryTrait.php.

◆ SpecBasedFactoryTrait

trait Wikimedia::Leximorph::Traits\SpecBasedFactoryTrait
Initial value:
{
protected string $langCode

SpecBasedFactoryTrait.

Trait for instantiating Leximorph objects from a spec map.

Since
1.45
Author
Doğu Abaris (abari.nosp@m.s@nu.nosp@m.ll.ne.nosp@m.t)
Note
https://www.gnu.org/copyleft/gpl.html GPL-2.0-or-later

Definition at line 23 of file SpecBasedFactoryTrait.php.