Git Product home page Git Product logo

potato-orm's People

Stargazers

 avatar

Forkers

olaseyo

potato-orm's Issues

No connection to Travis

Your project should be connected with Travis and your README file should have the badge that exhibits the passing/failure status

Model.php

Your functions should be as atomic as possible

try {
            $table = Backbone::mapClassToTable(get_called_class());
        } catch (TableDoesNotExistException $e) {
            return $e->message();
        }

This block of code is called in almost all the functions in this class. You can make a method for it and just call the method itself in place of this chunk everywhere

No connection to Travis

This should be connected to travis and the badge for passing/failing should be included in the README

Tests

Read Laravel's source code to have an idea about testing all your ORM methods here

DbConn.php

namespace Kola\PotatoOrm\Helper;
use Kola\PotatoOrm\Exception\UnsuccessfulDbConnException as ConnEx;
use \PDO;

Imports should be from shortest to longest. Rearrange

  /**
     * Override the parent class PDO constructor to prevent instantiation-argument requirement
     */
    public function __construct()
    {
    }

Any reason why there is an empty constructor here?

BackBone.php - Methods should be as atomic as possible, not looking like hell

public static function mapClassToTable($className)
    {
        $demarcation = strrpos($className, '\\', -1);
        if ($demarcation !== false) {
            $table = strtolower(substr($className, $demarcation + 1));
        } else {
            $table = strtolower($className);
        }
        if (! self::checkForTable($table)) {
            $temp = ucfirst($table);
            if (self::checkForTable($temp)) {
                return $temp;
            } else {
                $arrayOfCharInTable = str_split($table);
                if ($arrayOfCharInTable[count($arrayOfCharInTable) - 1] === 's') {
                    array_pop($arrayOfCharInTable);
                    $table = implode($arrayOfCharInTable);
                } else {
                    $table .= 's';
                }
                if (! self::checkForTable($table)) {
                    $temp = ucfirst($table);
                    if (self::checkForTable($temp)) {
                        return $temp;
                    } else {
                        throw new TableDoesNotExistException;
                    }
                }
            }
        }
        return $table;
    }

This function is doing too much.

$arrayOfCharInTable = str_split($table);
                if ($arrayOfCharInTable[count($arrayOfCharInTable) - 1] === 's') {
                    array_pop($arrayOfCharInTable);
                    $table = implode($arrayOfCharInTable);
                } else {
                    $table .= 's';
                }

can be abstracted into another method and just called with the necessary arguments.

if (! self::checkForTable($table)) {
                    $temp = ucfirst($table);
                    if (self::checkForTable($temp)) {
                        return $temp;
                    } else {
                        throw new TableDoesNotExistException;
                    }
                }

This is repeated, so you can have a method to accomodate it, then logically include it in the mapClassToTable() methods.

BackBone.php

Line 74 - it should be existence not existent

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.