S
S
sorry_i_noob2018-02-25 20:35:52
PHP
sorry_i_noob, 2018-02-25 20:35:52

Where to describe PHP traits? In a class file or in its own file?

I have a lot of traits and the class becomes difficult to read. I'm thinking of moving them to a separate file. But I write on the Kohana framework, and there is such a folder structure...
application
-cache
-classes
-config
-logs
-...
If you write in a separate file, do you need to create a directory for traits (I don't have one)? Traits are not classes.
Where are traits usually stored?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Decadal, 2018-02-25
@Decadal

in its own file. When it comes to organizing their placement, think of them the same as classes and interfaces.
You should think about what you are doing if the number of traits makes a class hard to read.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question