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 6.0 API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 6.0
      • 6.0
      • 5.4
      • 5.3
      • 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
    • AttributeResolver
      • ValueObject
    • Cache
    • Collection
    • Command
    • Console
    • Container
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Lock
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

Class AttributeInfo

Represents complete information about a discovered attribute.

This value object contains all metadata about an attribute found during scanning, including:

  • The class and file where it was found
  • The attribute class name and arguments
  • Where it's attached (via AttributeTarget)
  • Plugin context and file modification time for cache validation

This class is readonly and immutable for safe serialization and caching.

Namespace: Cake\AttributeResolver\ValueObject

Method Summary

  • __construct() public

    Constructor for AttributeInfo.

  • fromArray() public static

    Create from array data.

  • getInstance() public

    Instantiate the actual attribute object.

    Returns the attribute instance with its arguments applied, allowing access to attribute properties and methods.

  • isInstanceOf() public

    Check if the attribute is an instance of a given class.

    Uses is_a() with allow_string to check inheritance without instantiation.

  • jsonSerialize() public

    Specify data which should be serialized to JSON.

  • toArray() public

    Convert to array for serialization.

Method Detail

__construct() ¶ public

__construct(string $className, string $attributeName, array<string, mixed> $arguments, string $filePath, int $lineNumber, Cake\AttributeResolver\ValueObject\AttributeTarget $target, int $fileTime = 0, string|null $pluginName = null)

Constructor for AttributeInfo.

Parameters
string $className

Fully qualified class name containing the attribute

string $attributeName

Fully qualified attribute class name

array<string, mixed> $arguments

Attribute constructor arguments

string $filePath

Absolute path to file where attribute was found

int $lineNumber

Line number where attribute appears in file

Cake\AttributeResolver\ValueObject\AttributeTarget $target

Target information (what the attribute is attached to)

int $fileTime optional

File modification time (Unix timestamp) for cache validation

string|null $pluginName optional

Plugin name or null for App namespace

fromArray() ¶ public static

fromArray(array<string, mixed> $data): self

Create from array data.

Parameters
array<string, mixed> $data

Data array

Returns
self

getInstance() ¶ public

getInstance(class-string<T>|null $expectedClass = null): T|object

Instantiate the actual attribute object.

Returns the attribute instance with its arguments applied, allowing access to attribute properties and methods.

Templates
T of object
Parameters
class-string<T>|null $expectedClass optional

Optional expected class for type safety

Returns
T|object

The instantiated attribute (T if expectedClass provided, otherwise object)

Throws
RuntimeException
If the attribute class does not exist
InvalidArgumentException
If attribute doesn't match expected class

isInstanceOf() ¶ public

isInstanceOf(class-string $className): bool

Check if the attribute is an instance of a given class.

Uses is_a() with allow_string to check inheritance without instantiation.

Parameters
class-string $className

Class name to check against

Returns
bool

True if the attribute extends or implements the given class

jsonSerialize() ¶ public

jsonSerialize(): array<string, mixed>

Specify data which should be serialized to JSON.

Returns
array<string, mixed>

toArray() ¶ public

toArray(): array<string, mixed>

Convert to array for serialization.

Returns
array<string, mixed>
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