How good implement method? [closed]

55
July 20, 2021, at 00:30 AM
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 23 hours ago.

Improve this question

I'm learning PHP OOP

I get this error:

Class User contains 1 abstract method and must therefore be declared abstract or implement the remaining methods

Why 'User' does not implement method 'checkPermission' ?

i have a file User.php:

<?php
require_once("AbstractGuest.php");
class User extends AbstractGuest
{
    function __construct()
    {
        $this->permission = InterfacePermissions::READ_POST;
    }
}

also file: PermissionsInterface.php

<?php
interface InterfacePermissions
{
    const READ_POST = 1;
    const WRITE_POST = 2;
    const EDIT_POST = 4;
    const DELETE_POST = 8;
    const CREATE_USER = 16;
    const DELETE_USER = 32;
    function getPermission();
    function isPermitted($permission);
    static function checkPermission($userPermission, $permission);
}

and file AbstractGuest.php

<?php
require_once("PermissionsInterfaceA.php");
abstract class AbstractGuest implements InterfacePermissions
{
    protected $permission = 0;
    abstract function __construct();
    static function chceckPermission($userPermission, $permission)
    {
        if ($userPermission & $permission)
            return true;
        return false;
    }
    function getPermission()
    {
        return $this->permission;
    }
    function isPermitted($permission)
    {
        if ($this->permission & $permission)
            return true;
        return false;
    }
}

Thanks for any advice

Answer 1

chceckPermission is not the same as checkPermission

READ ALSO
Python relative import in subdirectory

Python relative import in subdirectory

I have a Python project, which has something like the following structure:

68
Ability to find certain pages through search

Ability to find certain pages through search

I want to have a search bar that search all the views that are static and supplies search results for example this page here has the function I need: https://cagenixcom/

51
React Router Dynamic Route: Invalid URL

React Router Dynamic Route: Invalid URL

<Route path={"/movie/:id"} component={ResultPage} />

50