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 PackageLocator

A ServiceLocator implementation for loading and retaining package objects.

Namespace: Cake\I18n

Property Summary

  • $converted protected
    array<string, array<string, bool>>

    Tracks whether a registry entry has been converted from a callable to a Package object.

  • $registry protected
    array<string, array<string, \Cake\I18n\Package|callable>>

    A registry of packages.

Method Summary

  • __construct() public

    Constructor.

  • get() public

    Gets a Package object.

  • has() public

    Check if a Package object for given name and locale exists in registry.

  • set() public

    Sets a Package loader.

Method Detail

__construct() ¶ public

__construct(array<string, array<string, \Cake\I18n\Package|callable>> $registry = [])

Constructor.

Parameters
array<string, array<string, \Cake\I18n\Package|callable>> $registry optional

A registry of packages.

See Also
PackageLocator::$registry

get() ¶ public

get(string $name, string $locale): Cake\I18n\Package

Gets a Package object.

Parameters
string $name

The package name.

string $locale

The locale for the package.

Returns
Cake\I18n\Package

has() ¶ public

has(string $name, string $locale): bool

Check if a Package object for given name and locale exists in registry.

Parameters
string $name

The package name.

string $locale

The locale for the package.

Returns
bool

set() ¶ public

set(string $name, string $locale, Cake\I18n\Package|callable $spec): void

Sets a Package loader.

Parameters
string $name

The package name.

string $locale

The locale for the package.

Cake\I18n\Package|callable $spec

A callable that returns a package or Package instance.

Returns
void

Property Detail

$converted ¶ protected

Tracks whether a registry entry has been converted from a callable to a Package object.

Type
array<string, array<string, bool>>

$registry ¶ protected

A registry of packages.

Unlike many other registries, this one is two layers deep. The first key is a package name, the second key is a locale code, and the value is a callable that returns a Package object for that name and locale.

Type
array<string, array<string, \Cake\I18n\Package|callable>>
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