Read write in file with methods in class in php