temirkhan / view
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.3|^8.0
This package is auto-updated.
Last update: 2024-11-15 20:07:55 UTC
README
DEPRECATED
It seemd like a good idea but now I think it is much more relevant to use:
$result = SomeParticularView::create($data);
Reasons:
- It is more transparent(you can track what is used and where).
- It is more reliable(much more relevant to declare
PostView::create(Post $post): array
thanPostView::createView($context): mixed
- In 90% of the cases we need stateless/dependency-free factories(no overhead with usage and even testing). So we can use static calls:
// this $data = PostView::createView($post); //instead of this $viewFactory = new PostView(); $data = $view->createView($post);
You can more detailed "example" here https://github.com/TemirkhanN/blog