#social 2018-05-17

2018-05-17 UTC
#
dansup
up201705417: have you seen the code? I think we should write our own
#
dansup
and it uses a lot of bad practices, I think we are better off writing our own :)
#
dansup
it doesnt meet PSR standards, that file contains 2 classes, almost every function is static for some reason
#
dansup
We can use the one I've written for my instagram project, it uses https://github.com/kitetail/zttp, https://fractal.thephpleague.com/ and https://github.com/bitverseio/identicon for default avatars
#
Loqi
[kitetail] zttp: A developer-experience focused HTTP client, optimized for most common use cases.
#
xmpp-social
[Takyoji] Or I can just address your concerns, which is the whole point as to why I'm asking for feedback. xP
#
xmpp-social
[Takyoji] Line 213-217 is just taking the values from the ordered array, and assigning them to strings to explain what values they hold, and assigning a default value, if one was not assigned.
#
xmpp-social
[Takyoji] List any bad practices and I'll address them. ActPubParser is acting as a central registry for the individual types, as for the static variables and functions.
#
dansup
takyoji: Hi, so I made an activitystreams library (still a wip), and I chose the factory pattern so the object type could be defined like this https://github.com/dansup/php-activitystreams/blob/master/src/Model/Object.php
#
dansup
using getters and setters could clean up a bit of your code
#
xmpp-social
[Takyoji] This is the point of that function: https://github.com/TechSanity/ActPubParser/blob/master/types/Note.php
#
xmpp-social
[Takyoji] You give it a list of values, from the JSON-LD type, to what property to store it to, whether it'll only ever be a single value ever, is it required, and what additional parsing/filtering to do
#
dansup
takyoji: how do you know what each param is? That is not very readable in that you have to lookup the extract_and_assign function to see the order of each param and what it does
#
xmpp-social
[Takyoji] Unless if you'd rather it be an associative array
#
xmpp-social
[Takyoji] of {"from": $ns."content", "to": "content", "single": true, "required": false, "parse": "value" } for a rule
#
dansup
or you could use __get() or __set() magic methods and define each attribute
#
xmpp-social
[Takyoji] This is a function extracting all that data from inputted JSONLD data, casting and transforming it to the properties of the class
#
xmpp-social
[Takyoji] it's not about accessing the properties
#
dansup
ah I see, oh this is just for parsing right?
#
xmpp-social
[Takyoji] Yes, and you could possibly flip it right back the other way as well
#
xmpp-social
[Takyoji] I could have another function that then transforms it to compacted JSON-LD
#
dansup
Cool, I didn't mean to sound like a jerk, you are helping the community by creating a new AP implementation and I was only trying to give feedback.
#
xmpp-social
[Takyoji] and then you can extend/replace the types, to build in any logic for how it stores the value in a database, or how it handles an Undo activity (per activity), and so on
fr33domlover, ajordan, xmpp-social, Sveta, tantek, vasilakisfil, JanKusanagi, jankusanagi_ and vasilakisfil_ joined the channel
#
dansup
special announcement today, 1 month since I released the first screenshot :)
#
dansup
will post the link here when its up
#
saranix
time flies
#
Loqi
[PixelFed] Hello World! https://pixelfed.org/
#
dansup
Introducing PixelFed :D
#
dansup
(its not ready yet, but pretty close!)
cwebber2 and Takyoji joined the channel
#
Takyoji
dansup: Ooo, nice site design and congratulations on the milestone.
#
Takyoji
(apparently the IRC-to-XMPP bridge isn't up, tried messaging earlier)
#
Takyoji
Also, any better now? xP https://github.com/TechSanity/ActPubParser (decoupled some components, cleaned up names and structure, added meaningful unit tests, simplified greatly, works out-of-the-box now with sane sample defaults in just 3 lines of code)
#
Loqi
[TechSanity] ActPubParser: PHP library which decodes any ActivityPub object and provides a simple, objected-oriented interface.
#
dansup
Takyoji: thanks! I like the refactor, good job!
ajordan joined the channel