Skip to content

Internals Objects

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

Objects internals

Framework Internals · Developer guide

ObjectHandler includes a real file once, examines declared classes through ReflectionClass, and selects a nonabstract class whose declaring filename is the included file. It returns null when none is found; createObjectFromFile instantiates without arguments. Dependencies included by the file do not become the selected runtime accidentally.

ObjectFactory chooses an explicit class name or infers it from classPath. It reflects the class, rejects abstract classes, constructs with configured arguments, verifies optional type, assigns configured properties and invokes ordered method calls. DEBUG controls several exception-versus-null/skip decisions; constructors, inaccessible members and method failures still follow normal PHP behavior. setClassPath requires an existing path; className includes namespace when relevant.

Factories are configuration recipes rather than singleton guarantees. RouteExecutor caches its created controller by replacing that route's factory, while ordinary create() calls create fresh objects. Runtime passables and shared objects retain references through the executor registries for the request.

ObjectCollection stores an array of objects, optional strict type, key/order/multiple sort keys and custom priority maps. sortByKey uses array_multisort; sortByValue uses a comparator with null/numeric/string/custom-map ordering. find is direct index lookup when not value-sorted, otherwise binary search using the selected property. Callers must align search with ordering. The callable accessor API has a ?string backing property, so non-string callables are currently unsafe.

Component reference

Clone this wiki locally