src/bbn/user/permissions.php
public function from_path(string $path, $type = 'page'): ?string
  {
    $parent = null;
    if ( $root = $this->opt->from_code($type, self::$option_root_id) ){
      $parts = explode('/', $path);
      $parent = $root;
      foreach ( $parts as $i => $p ){
        $is_not_last = $i < (\count($parts) - 1);
        if ( !empty($p) ){
          $prev_parent = $parent;
          // Adds a slash for each bit of the path except the last one
          $parent = $this->opt->from_code($p.($is_not_last ? '/' : ''), $prev_parent);
          // If not found looking for a subpermission
          if ( !$parent && $is_not_last ){
            $parent = $this->opt->from_code($p, $prev_parent);
          }
        }
      }
    }
    return $parent ?: null;
  }
public function from_path(string $path, $type = 'page'): ?string
  {
    $parent = null;
    if ( $root = $this->opt->from_code($type, self::$option_root_id) ){
      $parts = explode('/', $path);
      $parent = $root;
      foreach ( $parts as $i => $p ){
        $is_not_last = $i < (\count($parts) - 1);
        if ( !empty($p) ){
          $prev_parent = $parent;
          // Adds a slash for each bit of the path except the last one
          $parent = $this->opt->from_code($p.($is_not_last ? '/' : ''), $prev_parent);
          // If not found looking for a subpermission
          if ( !$parent && $is_not_last ){
            $parent = $this->opt->from_code($p, $prev_parent);
          }
        }
      }
    }
    return $parent ?: null;
  }
public function from_path ( string $ path , $ type = 'page' ) : ? string { $ parent = null ; if ( $ root = $ this -> opt -> from_code ( $ type , self :: $ option_root_id ) ) { $ parts = explode ( '/' , $ path ) ; $ parent = $ root ; foreach ( $ parts as $ i => $ p ) { $ is_not_last = $ i < ( \ count ( $ parts ) - 1 ) ; if ( ! empty ( $ p ) ) { $ prev_parent = $ parent ; // Adds a slash for each bit of the path except the last one $ parent = $ this -> opt -> from_code ( $ p . ( $ is_not_last ? '/' : '' ) , $ prev_parent ) ; // If not found looking for a subpermission if ( ! $ parent && $ is_not_last ) { $ parent = $ this -> opt -> from_code ( $ p , $ prev_parent ) ; } } } } return $ parent ? : null ; }
Returns the option's ID corresponds to the given path.

@param string $path
@param string $type
@return null|string
Returns the option s ID corresponds to the given path .