Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I can't get a peer review where I work, I was wondering how my code was and how could it be improved.

https://github.com/lamondea/uploader

Is it a good practice to use functions in classes or should it be replaced by external function that use the object returned by the class:

class _export
{   
    public $nbr;
    public $file;

    public function __construct($file,$nbr=0){
        if($nbr != 0 && ($file->ext == 'jpg' || $file->ext == 'png' || $file->ext == 'gif'))
            thumbnailer($file,$nbr);
        else {
            move_uploaded_file($file->tmp_name, ($file->loc).($file->name));
            return $file->name;
        }
    }
}
share|improve this question
1  
Could you include some code to the question, please? Unfortunately (according to the FAQ) question without inline code are off-topic here. – palacsint Feb 26 at 17:33
I really never used peer review and I just started using classes, so I guess the whole /class/uploader.class.php would be the important for that matter. I will add a part, but still it would be hard to choose a part since the uploader work. – Zeppo Feb 26 at 17:53
1  
Two general things about the code, 1) class name shouldn't start with "_", 2) Looks like you are doing the validation in constructor which is not good. Let the constructor just for initialization stuff. – Kinjal Feb 27 at 8:36
Is there a norm about naming the classes? – Zeppo Feb 27 at 13:46

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.