-1

I have a huge php class with very long code in it. This make the file is big with lots of coding and hard to maintain. Is there anyway that I can split the class into a few files for easier maintaining?

Thank you.

user1995781
  • 19,085
  • 45
  • 135
  • 236

1 Answers1

0

It depends on whether or not you can split the class in to subclasses.

What I mean is that you should ask yourself "does this method apply to this class or would it belong to a subclass?"

For example,

Class Animal
  - dog_bark()

dog_bark() could be moved to a class named Dog, and the method renamed to bark()

sunny
  • 1,156
  • 8
  • 15