docs icon indicating copy to clipboard operation
docs copied to clipboard

Class Phalcon\Config: path() method poorly specified

Open Chealer opened this issue 4 years ago • 2 comments

The Methods section of Phalcon\Config's documentation describes path():

public function path( string $path, mixed $defaultValue = null, mixed $delimiter = null ): mixed | null;

Returns a value from current config using a dot separated path.

It would greatly help to properly specify that method, indicating what value is returned.

By the way, if that is how values are obtained, renaming to something like "get" would surely clarify.

Chealer avatar Apr 22 '21 15:04 Chealer

It already has get() method inherited from Collection class, but they work differently. path() is a wrapper on top of get().

hakimio avatar Jun 22 '21 09:06 hakimio

path is a nested get so to speak.

Imagine:

database
    adapter: Mysql
$value = $config->get('database'); // Config object
$adapter = $value->get('adapter'); // string `Mysql`

vs

$adapter = $config->path('database.adapter');  // string `Mysql`

niden avatar Jun 22 '21 13:06 niden