CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 4.6 Strawberry API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 4.6
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
      • Exception
      • Formatter
      • Middleware
      • Parser
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class FormatterLocator

A ServiceLocator implementation for loading and retaining formatter objects.

Namespace: Cake\I18n

Property Summary

  • $converted protected
    array<bool>

    Tracks whether a registry entry has been converted from a FQCN to a formatter object.

  • $registry protected
    array<string, \Cake\I18n\FormatterInterface|class-string<Cake\I18n\FormatterInterface>>

    A registry to retain formatter objects.

Method Summary

  • __construct() public

    Constructor.

  • get() public

    Gets a formatter from the registry by name.

  • set() public

    Sets a formatter into the registry by name.

Method Detail

__construct() ¶ public

__construct(array<string, class-string<Cake\I18n\FormatterInterface>> $registry = [])

Constructor.

Parameters
array<string, class-string<Cake\I18n\FormatterInterface>> $registry optional

An array of key-value pairs where the key is the formatter name the value is a FQCN for the formatter.

get() ¶ public

get(string $name): Cake\I18n\FormatterInterface

Gets a formatter from the registry by name.

Parameters
string $name

The formatter to retrieve.

Returns
Cake\I18n\FormatterInterface
Throws
Cake\I18n\Exception\I18nException

set() ¶ public

set(string $name, class-string<Cake\I18n\FormatterInterface> $className): void

Sets a formatter into the registry by name.

Parameters
string $name

The formatter name.

class-string<Cake\I18n\FormatterInterface> $className

A FQCN for a formatter.

Returns
void

Property Detail

$converted ¶ protected

Tracks whether a registry entry has been converted from a FQCN to a formatter object.

Type
array<bool>

$registry ¶ protected

A registry to retain formatter objects.

Type
array<string, \Cake\I18n\FormatterInterface|class-string<Cake\I18n\FormatterInterface>>
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs