Skip to main content

All Questions

Tagged with
4 votes
1 answer
142 views

PHP CSV Parser: Separation of concerns and SOLID principles

I implemented a CSV Parser with Separation of concerns and SOLID principles in mind. Does that code match the principles? Here a sample data (CSV): ...
friday-json's user avatar
1 vote
2 answers
238 views

Boolean Value Object

Purpose: I want to accept the value of a checkbox or database field and make a Value Object out of it. The input could be any of y, Y, n, N, Yes, No, yes, no, 1, 0, true, false, or NULL. In the case ...
Tim Morton's user avatar
2 votes
1 answer
107 views

HTML form Class

After my previous question I revised the code to the code below. I am using PHP 7.0.33 and tried to accomplish PSR-12 as much as I could. In "condensed usage" in the docblock you can find a ...
julio's user avatar
  • 199
2 votes
1 answer
71 views

Creating multiple conditions in objects preventing nesting

My class is a factory-method that allows to instantiate it only when the parameter $type (string) is "regular or premium" and when parameter $months (integer) is lower than 6. If $months is ...
Ricardo Castañeda's user avatar
0 votes
1 answer
81 views

GPG class for AJAX calls

I want to know if this GPG class in PHP is up to snuff as a professional-level class. I did my best to include everything and make it easy to use. I'm calling the object by invoke(). If anyone can ...
Anthony Pulse's user avatar
3 votes
1 answer
326 views

Applying the Strategy pattern for payment methods

The strategy pattern is applied in the code below in the payment separation solution. Please evaluate if it is well done according to standards. I would be very grateful for suggestions. ...
Łukasz Luq's user avatar
7 votes
2 answers
964 views

OOP PHP form builder with validation

Yes, another PHP form builder... I wrote this solely to demonstrate OOP principles. My questions are: Could this be written better? OOP-wise. How could I better implement error handling? Index.php <...
PRobert's user avatar
  • 73
-2 votes
1 answer
196 views

Insert row into database using static or non-static method [closed]

I would like to know if there are any benefits of one of the following 2 methods which insert an object into a database The first function calls the Model method statically, creating a new instance of ...
Raging_Jim_Lahey's user avatar
0 votes
1 answer
239 views

Refactoring this code into OOP & less functional programming

I got feedback from an interview test where they wanted me to prove that I've got a grasp of OOP php programming. This file especially I got feedback on that it's more functional than it is Object-...
Metwesh's user avatar
  • 21
2 votes
1 answer
314 views

PHP OOP: Configuring MySQL DB & query w/ Twig

I decided to up my PHP game and learn some OOP. I am re-building my website from procedural to OOP, but since I don't want to use a full framework I fiddle with some components. As a router I use ...
bender's user avatar
  • 21
10 votes
2 answers
3k views

Is my PHP login system following best practices? Is the code really OOP?

I'm learning about OOP and putting my knowledge into practice. I created a login system in PHP, so I wish someone could tell me if I'm on the right track. I feel like I'm getting better at coding, but ...
Warlock's user avatar
  • 301
4 votes
1 answer
100 views

PHP object oriented programming

I'm trying to learn OOP with PHP (I know it's hard because It's not an OOP language). I'm rewriting my procedural code to OOP.Please provide any feedback on my code, naming and file/folder structure. ...
flowstacker's user avatar
2 votes
1 answer
178 views

Prevent Column Name Collision

I have been working on a series of posts about a library to connect to databases but most of the scenarios I have to resort to some "JOIN" the problem arose when two or more tables had some ...
user avatar
7 votes
2 answers
229 views

Connect to MYSQL database in PHP with prepared statements

I have recently learned about using the functions exposed by the PDO extension. I created a db class which can handle common actions like create, update, delete and select. Is this method a correct ...
Sanidhya's user avatar
  • 173
-1 votes
2 answers
88 views

Simple Vehicle speed representation [closed]

This code models two vehicle types, with a method to accept a string representing a boost to change speed. How can I optimize performance in inheritance child class? How can I reduce the code inside ...
manas's user avatar
  • 9

15 30 50 per page
1
2 3 4 5
44