Bcp47Code
Simple interface representing languages which have a BCP 47 code
Loading...
Searching...
No Matches
Wikimedia\Bcp47Code\Bcp47CodeValue Class Reference

This is a simple value object demonstrating the simplest possible implementation of the Bcp47Code interface. More...

+ Inheritance diagram for Wikimedia\Bcp47Code\Bcp47CodeValue:

Public Member Functions

 __construct (string $bcp47code)
 Create a new instance of this value object representing a language with the given BCP 47 code.
 
 toBcp47Code ()
 @inheritDoc
 
 isSameCodeAs (Bcp47Code $other)
 @inheritDoc
 
 __toString ()
 

Static Public Member Functions

static fromBcp47Code (Bcp47Code $language)
 Simple helper to coerce any Bcp47Code into a Bcp47CodeValue.
 
static isSameCode (Bcp47Code $a, Bcp47Code $b)
 Simple helper to compare Bcp47Code in the proper case-insensitive manner.
 

Detailed Description

This is a simple value object demonstrating the simplest possible implementation of the Bcp47Code interface.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Bcp47Code\Bcp47CodeValue::__construct ( string $bcp47code)

Create a new instance of this value object representing a language with the given BCP 47 code.

Parameters
string$bcp47codethe BCP 47 code for the language

Member Function Documentation

◆ fromBcp47Code()

static Wikimedia\Bcp47Code\Bcp47CodeValue::fromBcp47Code ( Bcp47Code $language)
static

Simple helper to coerce any Bcp47Code into a Bcp47CodeValue.

Parameters
Bcp47Code$languagean object representing a language
Returns
Bcp47CodeValue a simple value object representing a language.

◆ isSameCode()

static Wikimedia\Bcp47Code\Bcp47CodeValue::isSameCode ( Bcp47Code $a,
Bcp47Code $b )
static

Simple helper to compare Bcp47Code in the proper case-insensitive manner.

Parameters
Bcp47Code$a
Bcp47Code$b
Returns
bool True if the bcp-47 codes should be considered equal

◆ isSameCodeAs()

Wikimedia\Bcp47Code\Bcp47CodeValue::isSameCodeAs ( Bcp47Code $other)

@inheritDoc

Implements Wikimedia\Bcp47Code\Bcp47Code.

◆ toBcp47Code()

Wikimedia\Bcp47Code\Bcp47CodeValue::toBcp47Code ( )

@inheritDoc

Implements Wikimedia\Bcp47Code\Bcp47Code.


The documentation for this class was generated from the following file: