Welcome Guest, Not a member yet? Register   Sign In
return value of settings helper call?
#4

@kenjis,

The helper is saying it returns all.
PHP Code:
<?php

use CodeIgniter\Settings\Settings;

if (! 
function_exists('setting')) {
    /**
    * Provides a convenience interface to the Settings service.
    *
    * @param mixed $value
    *
    * @return array|bool|float|int|object|Settings|string|void|null
    * @phpstan-return ($key is null ? Settings : ($value is null ? array|bool|float|int|object|string|null : void))
    */
    function setting(?string $key null$value null)
    {
        /** @var Settings $setting */
        $setting service('settings');

        if (empty($key)) {
            return $setting;
        }

        // Getting the value?
        if (count(func_get_args()) === 1) {
            return $setting->get($key);
        }

        // Setting the value
        $setting->set($key$value);
    }



This is the helper, look at the top return values so which is correct?
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: return value of settings helper call? - by InsiteFX - 09-22-2023, 08:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB