public function add(string $profile, $inheritContext = false)
    {
        if ($this->has($profile)) {
            throw new Exception("Profile {$profile} already exist.");
        }

        if (!strlen($profile)) {
            throw new Exception("Profile must be set.");
        }

        $child = clone $this;
        $child->clear(!$inheritContext);
        $child->name     = ($this->name ? $this->name . ' > ' : '') . $profile;
        $child->children = [];

        $this->children[$profile] = $child;

        return $child;
    }
public function add(string $profile, $inheritContext = false)
    {
        if ($this->has($profile)) {
            throw new Exception("Profile {$profile} already exist.");
        }

        if (!strlen($profile)) {
            throw new Exception("Profile must be set.");
        }

        $child = clone $this;
        $child->clear(!$inheritContext);
        $child->name     = ($this->name ? $this->name . ' > ' : '') . $profile;
        $child->children = [];

        $this->children[$profile] = $child;

        return $child;
    }
public function add ( string $ profile , $ inheritContext = false ) { if ( $ this -> has ( $ profile ) ) { throw new Exception ( "Profile {$profile} already exist." ) ; } if ( ! strlen ( $ profile ) ) { throw new Exception ( "Profile must be set." ) ; } $ child = clone $ this ; $ child -> clear ( ! $ inheritContext ) ; $ child -> name = ( $ this -> name ? $ this -> name . ' > ' : '' ) . $ profile ; $ child -> children = [ ] ; $ this -> children [ $ profile ] = $ child ; return $ child ; }
Add child profile.

@param string $profile
@param bool   $inheritContext [optional] Also set context for child profile?

@return Profiler
@throws Exception
Add child profile .