Tagged Questions
3
votes
1answer
82 views
Improvement of my php code
I wrote a class with this function. Can I improve my code performance in the bottom of the function? I don't like the while loops!
public function loadFields(array $fields, $as_object = ...
2
votes
1answer
38 views
Can I do something better in that code? And improvements?
Hi guys, simple question!
Can I do something better with the code I wrote.
It's running problem less. It's just a snippet of a library I wrote.
Thank you for all answers!
<?php
/*
* ...
-1
votes
0answers
29 views
Object Oriented PHP - mysql database manipulation [closed]
Been working with this code but it won't run. Please help me find the problem with this.
THis is my class :
<?php
class mysqlcon
{
private $connection;
private $database;
public $query;
...
3
votes
1answer
84 views
Best OOP method for a layout library
I had a code for a layout library which looked like :
$this->layout->setLayout($layout)->setTitle($title)->render()
etc.
Today I started writing a new code, simpler and smaller :
...
0
votes
1answer
52 views
Image Resize/Crop Class
I've combined some of my own functions with a function I found and I'm curious to know what others think of it. It will be used to upload and resize/crop images that are jpeg, jpg, png.
<?php
...
0
votes
1answer
43 views
Should a User class only contain attributes and no methods apart from getters/setters?
I'm trying to improve my OOP code and I think my User class is becoming way too fat.
In my program a user has rights over "lists". Read, Write, Update, Delete.
So I made a User class
class User
{
...
1
vote
4answers
181 views
Making this code 'more' OOP
I have just started to try and learn 'OOP' but it appears I'm doing this wrong, according to the people on StackOverflow the code below is far from Object Orientated, but I'm finding it hard as I'm ...
2
votes
1answer
79 views
Abstraction for multiple connection methods
Coding to the interface, rather than the implementation. Here is what I'm doing in simple terms.
Note: Although written using PHP, this is more of a general design / abstraction question that ...
3
votes
1answer
61 views
Static variable in method vs private class property
I have a class with a method that will be called multiple times over an object's lifetime to perform some processing steps. This method operates on a mixture of immutable (does not change over the ...
1
vote
1answer
42 views
autoloader class fine tune to be usable in every project
I'm open to any advice to help improve this code for general use.
/**
*
* This code was created by Joshua Getner.
* @license http://opensource.org/licenses/bsd-license.php BSD
*
*
*/
namespace ...
0
votes
0answers
36 views
Getting colors from an image PHP
I am working on a site that themes itself based on images / logos. I have built the class that gets the colors from image, shown below. I am fairly new to OOP with PHP and looking for feedback on what ...
0
votes
2answers
56 views
along right lines for an application class for mvc?
Please could you review and critic my code and logic. If this is along the right lines for an application mvc class or not. Thanks
namespace dh_mvc2;
use dh_mvc2\dispatchers\Base_Dispatcher;
use ...
0
votes
1answer
41 views
php autloader class reviews welcome
is this class ok? any and all advice very welcome. Would it be better to pass the config file path array into the constructor or even through the static register method
namespace dh_mvc2\autoloaders;
...
0
votes
2answers
58 views
PHP Class that handles all includes / required files
In effort to streamline applicable PHP file include or require functions I thought that making a class to handle this might be a good idea.
Originally I had an includes/init.php file that included ...
2
votes
1answer
72 views
Scope Resolution Operators and class variables in PHP OOP
I am new to this site, so I apologize if this question is not welcome. I am also new to OOP in PHP. I have done a lot of research on OOP and I keep seeming to read different opinions on several items, ...