Answer the question
In order to leave comments, you need to log in
How to port a decorator function from python to php?
I am porting one application from python to php and there was a problem.
Faced with this kind of functions
@property
def keys(self):
return self.__keys
@keys.setter
def keys(self, mas):
for k in mas:
self.__keys.append(k.lower())
command_list = []
class Command:
def __init__(self):
self.__keys = []
self.description = ''
command_list.append(self)
@property
def keys(self):
return self.__keys
@keys.setter
def keys(self, mas):
for k in mas:
self.__keys.append(k.lower())
def process(self):
pass
Answer the question
In order to leave comments, you need to log in
I don't understand what the problem is. In the first case, an array is returned from the object, in the second, strings are added to the end of the array.
function keys(self, mas=null) {
if (func_num_args() == 1) {
// один аргумент
} else {
// два аргумента
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question