7
votes
Accepted
Address class in PHP 7.4 with types
I saw your post yesterday before it was deleted. I didn’t have much to suggest but after seeing this code there are a few things I would change.
The suggestions by YourCommonSense are great:
Specific ...
7
votes
Accepted
PHP HTML form Class - so far so good?
I have not conducted a deep review of your scripting, but I have a few pieces of superficial advice:
Study PSR-12 coding standards and obey every rule. This will make your code easier for you and ...
6
votes
PHP HTML form Class - so far so good?
You could make it much more simpler to read if you use templating engine. Rendering HTML right inside php is something many experienced developers try to avoid for multitude of reasons.
One of them ...
5
votes
Address class in PHP 7.4 with types
I was able to come up with two suggestions so far
Using a generic exception is definitely not the way to go. Ask yourself a question, what your code is supposed to do when such an exception is thrown? ...
4
votes
To-do app API made with Slim 3
In short, no. Actually doesn't seem to be structured in any way :D
If your API will be just that, you can even give up on slim and have a plain index.php with url rewrite so you can achieve the best ...
4
votes
Accepted
Automated Tweet of new inbound Enquiries in PHP7 (Laravel 5.2)
Code intent
The main problem with your code is that it does not give any reasons as to why it performs the way it does which makes understanding, reviewing or upgrading it difficult.
...
4
votes
Accepted
PHP Class to render HTML div styled tables v1
I'm not overly bothered by the amount of arguments in your __construct() method. It looks fine to me.
There are however some classic coding problems:
Repetition
...
4
votes
Accepted
PHP Pagination class (Clase para paginar resultados)
Yes. So many things must be improved here that I don't even know where to start.
The class structure
Probably the most important issue of all. Strictly speaking, it is not a class. It's rather a ...
3
votes
Accepted
To-do app API made with Slim 3
Is the application well-structured or should I move the logic into controllers?
I agree with NemoXP that the current format is not well-structured. A file with 112 lines of code isn't horrible in ...
3
votes
Applying the Strategy pattern for payment methods
It looks like what you did was more like the Factory pattern. In fact, you have a Factory class in your code there.
I found a great explanation here in case you want to look into the differences ...
2
votes
PHP loop to generate an HTML form for the days in the coming week
To be honest, I was able to pickup and read you code really easily and understand it, which is the end goal. So what you have already is fine if you want to stick with it.
In saying that, there are a ...
2
votes
PHP loop to generate an HTML form for the days in the coming week
Initial Thoughts
Initially I was thinking of suggesting a view class that could hold the states and weekdays in instance variables, then have methods to get the header for each state and then display ...
2
votes
Accepted
Usage of Factory pattern for maintaing bookshelf having books, magazine and notes
Is that really how a bookshelf work?
"Hello Magic Bookshelf, report status!"
"Bookshelf contain 0 items, remaining capacity is 3"
"Ok, spawn a new item!"
"0"
&...
2
votes
Accepted
HTML form Class
Review
Related to the code itself, the approach on array parameters, efficiency and ease of use, are there any suggestions?
The code has come a long way since the first version posted.
At first ...
2
votes
Accepted
Archiving / Moving Data from one database server to another database server
As I see it, 99% of your code is spent in ALTER TABLE -- both in adding partitioning in REMOVE PARTITIONING, so my answer ...
1
vote
PHP Class to render HTML div styled tables v2 [reviewed by me]
I haven't reviewed the script from a high altitude for is design architecture, but from my phone I found a few points to mention.
Why is it valuable to return true ...
1
vote
Archiving / Moving Data from one database server to another database server
This review will focus on the PHP to generate the queries. Other reviewers may have suggestions about improving the partition process.
General feedback
The code is easy to read and mostly is in line ...
1
vote
Accepted
Building a pre-loader for performance gains in Wordpress
I honestly haven’t used Wordpress much - just assisted with a company project that used it about 6 years ago. The biggest thing I notice is that the syntax used to declare arrays is the legacy syntax, ...
1
vote
Adjusting variables on change of status attribute of my Order Laravel model on the updated event in observer
Nine status combinations
Status can either be 0, 1, or 2, so there are 8 possible changes in status.
There are nine (three states multiplied by three states) possible "changes" (state ...
1
vote
Accepted
Scrape multiple twitch IRC chats
Title idea: How to refactor simple API Client code in PHP CLI
Here are a couple of tips:
I would add if's and switch'es as soon ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
php7 × 17php × 16
classes × 6
object-oriented × 4
design-patterns × 3
html × 2
sql × 2
form × 2
laravel × 2
performance × 1
array × 1
api × 1
html5 × 1
iteration × 1
factory-method × 1
wordpress × 1
pagination × 1
type-safety × 1
observer-pattern × 1
doctrine × 1
slim × 1
yii × 1
strategy-pattern × 1
symfony4 × 1