You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wouldn't be great to encapsulate the attributes manipulation? That could be very useful eg. in the Request class. Regarding casting I thought of something as simple as:
CastableContract
CastableTrait
abstractclass Model implements ArrayAccess, Arrayable, Castable, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable
{
use CastableTrait;
…
}
class Request extends SymfonyRequest implements Arrayable, ArrayAccess, Castable
{
use CastableTrait, Macroable;
…
}
In combination with custom casting discussed in #16305 and #13706 it could be a very powerfull and yet a clean solution. Another approach could be a Processor/Transformer implementation (this is just a basic idea inspired by the need to encapsulate request data processing):
Processable contract
interface Processable
{
/** * Get the processed contents of the object. * * @return mixed */publicfunctionprocessed();
}
an object/array could be also easily processed with a processor composite:
Wouldn't be great to encapsulate the attributes manipulation? That could be very useful eg. in the Request class. Regarding casting I thought of something as simple as:
In combination with custom casting discussed in #16305 and #13706 it could be a very powerfull and yet a clean solution. Another approach could be a
Processor
/Transformer
implementation (this is just a basic idea inspired by the need to encapsulate request data processing):or maybe better interally by
all()
,input()
,except()
etc.?The text was updated successfully, but these errors were encountered: