-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update User
#1
Update User
#1
Conversation
src/Data/User.php
Outdated
protected $default_lang; | ||
protected $dateOfBirth; | ||
protected $bdayPrivary; | ||
protected $fullName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這裡的欄位不用駝峰 style 是跟著 https://www.plurk.com/API#user_data 的定義走的,一對一對應。
另外是
$genre = $user->genre;
跟
$genre = $user->toArray()['gender'];
後者相對不是這麼容易閱讀...
如果是以避免參數被改,我建議的方式會是 magic getter 然後不寫 setter,然後把變數放在 array 裡面。不過相對 code 是沒那麼一目了然,而且這東西不會有「寫入回 plurk」的行為,所以原本沒想花力氣擋他...
coding style 改回來好了。 另外關於
我個人比較傾向改成 protected 以下,畢竟 object 傳來傳去,天小得會不會有人少打一個 |
This reverts commit 335c01d. Keep the variable name style in Plurk API
那.. 我的想法還是一樣 // 這樣看起來很彆扭也不好讀
$genre = $user->toArray()['gender'];
// 這樣看起來很累贅,不如打一開始就是 array
// 但一開始就是 array 就沒辦像 $user->public_posts(舉例) 這樣用
// 而且那就跟 master 現況基本一樣(死
$user = $user->toArray();
$genre = $user['gender']; |
例如我們不用
ps. genre 的確不好處理,但是我想你過年應該好好休息 XD |
yeap,我的意思是我推薦用 get XD |
那就用 有空在請你幫我看看這個 patch 是否和你胃口 |
This reverts commit 4061631. Use `__get()` instead of `toArray()`
excluded property `$app`
我把 在麻煩有空幫我 review 一下,謝謝 |
甘瞎~ |
there is an update of composer. and some changes below:
User
toArray
I do not exactly know what method
makeArray
is for ? May I have an example ?Thanks