N
N
Nikoblood2014-07-30 17:52:33
PHP
Nikoblood, 2014-07-30 17:52:33

Is it necessary to dress all variables in the class with properties?

There is a class. It has many methods. Let's say there is a certain method that uses two class properties that are used in no other method. Let it, for example, return some result and operate on two variables.
Do these two variables need to be declared as class properties, or can they be left as dynamic variables? Or is it already a bad tone?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Nikolaevich, 2014-07-30
@Nikoblood

bad form is to create confusion where it could be dispensed with.
if variables are needed for local work, then there is no need to take them out anywhere.
properties take out data with which several methods work or external code

D
Dmitry Guketlev, 2014-07-30
@Yavanosta

Some kind of porridge.

a specific method whose properties are not used in any other method
method properties?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question