Skip to content

Commit

Permalink
codecov badge + docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanJA committed Aug 16, 2017
1 parent e27b71d commit ca87a49
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ sudo: false
language: php

php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm

before_script:
- composer install -n
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[![Build Status](https://travis-ci.org/SeanJA/query-builder.svg?branch=master)](https://travis-ci.org/SeanJA/query-builder)
[![Code coverage](https://codecov.io/gh/SeanJA/query-builder/branch/master/graph/badge.svg)](https://codecov.io/gh/SeanJA/query-builder)

Requirements
==

* PHP 5.2 +
* PHP 5.5 +

TODO
==

List some todos...
* PHP 5.2 branch

Examples
==
Expand Down
19 changes: 13 additions & 6 deletions source/DbInterface.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
<?php

namespace SeanJA;

interface DbInterface
{
/**
* Escape a value
* @param $value
*
* @param string $value The value to be escaped
*
* @return string
*/
public function escape($value);

/**
* Quote a string
* @param $value
* @return mixed
*
* @param string $value The value to be quoted
*
* @return string
*/
public function quote($value);

/**
* Quote a field
* @param $value
* @return mixed
*
* @param string $field The field to be quoted
*
* @return string
*/
public function fieldQuote($value);
public function fieldQuote($field);
}
30 changes: 22 additions & 8 deletions tests/source/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,31 @@

use SeanJA\DbInterface;

/**
* Class Db
* @package Tests\SeanJA
*/
class Db implements DbInterface
{
/**
* Wrap string in this
*
* @var string
*/
const QUOTE = "'";
/**
* Wrap fields in this
*
* @var string
*/
const FIELD_QUOTE = "`";

/**
* Escape a value
* @param $value
* @return mixed
*
* @param string $value The value to be escaped
*
* @return string
*/
function escape($value)
{
Expand All @@ -27,8 +37,10 @@ function escape($value)

/**
* Quote a string
* @param $value
* @return mixed
*
* @param string $value The value to be quoted
*
* @return string
*/
public function quote($value)
{
Expand All @@ -37,11 +49,13 @@ public function quote($value)

/**
* Quote a field
* @param $value
* @return mixed
*
* @param string $field The field to be quoted
*
* @return string
*/
public function fieldQuote($value)
public function fieldQuote($field)
{
return static::FIELD_QUOTE . $value . static::FIELD_QUOTE;
return static::FIELD_QUOTE . $field . static::FIELD_QUOTE;
}
}

0 comments on commit ca87a49

Please sign in to comment.