Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/temirkhann/view
https://github.com/temirkhann/view
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/temirkhann/view
- Owner: TemirkhanN
- Created: 2019-09-15T17:59:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-15T15:23:24.000Z (about 2 years ago)
- Last Synced: 2024-04-19T18:42:23.867Z (7 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# view
## DEPRECATED
## It seemd like a good idea but now I think it is much more relevant to use:
```php
$result = SomeParticularView::create($data);
```**Reasons:**
1. It is more transparent(you can track what is used and where).
2. It is more reliable(much more relevant to declare ```PostView::create(Post $post): array``` than ```PostView::createView($context): mixed```
3. In 90% of the cases we need stateless/dependency-free factories(no overhead with usage and even testing). So we can use static calls:
```php// 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](https://github.com/TemirkhanN/blog/commit/ab34575a099ffd06dda27419b19196c5674a78d8)