1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved How to check if the string can be resolved by ItemFactory

Discussion in 'Development' started by TestDevelopment, Feb 22, 2021.

  1. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    I have problems with this code:
    PHP:
    private function getId($name){
            if(!
    $name == ""){
                if(
    $this->isItem(ItemFactory::fromString($name)->getId())){
                    return 
    ItemFactory::fromString($name)->getId();
                }


            }

            return 
    0;

        }
       
    Is it somehow possible to check if the String is vaild?
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    TestDevelopment and Primus like this.
  3. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    Thx, but i didnt had any problems with the condition, but anyway thx
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.