php sınıf bir daha statik approch, vs approch uzatmak

0 Cevap php

1 approch:

class Storage extends SaeStorage {
public function save($data,$name){
    if (! $this->write ( ST_DOMAIN, $name, $data )){
        $error_message =    $this->errmsg();
        $result['error'] = $error_message;
        return $result;
    }else{
        $url = $this->getUrl ( ST_DOMAIN, $name );
        return $url;
    }   
}

}

yaklaşım 2:

class Storage  {
public static  function save($data,$name){
    $SaeStorage = new SaeStorage();
    if (! $SaeStorage->write ( ST_DOMAIN, $name, $data )){
        $error_message =    $this->errmsg();
        $result['error'] = $error_message;
        return $result;
    }else{
        $url = $SaeStorage->getUrl ( ST_DOMAIN, $name );
        return $url;
    }   
}

}

0 Cevap