for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Main Class
*
* PHP version 5.4
* @category GLICER
* @package GlSpellChecker
* @author Emmanuel ROECKER
* @author Rym BOUCHAGOUR
* @copyright 2015 GLICER
* @license MIT
* @link http://dev.glicer.com/
* Created : 04/05/15
* File : GlSpellCheckerError.php
*/
namespace GlSpellChecker;
* Class GlSpellCheckerError
class GlSpellCheckerError
{
* @var array $suggs
private $suggs;
* @var string
private $msg;
* @var int
private $length;
private $offset;
* @param string $msg
* @param int $offset
* @param int $length
* @param string $word
* @param array $suggs
public function __construct($msg = '', $offset = null, $length = null, $word = '', $suggs = [])
$this->msg = $msg;
$this->offset = $offset;
$this->length = $length;
$this->word = $word;
word
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->suggs = $suggs;
}
* @param GlSpellCheckerError $mergeerror
public function merge(GlSpellCheckerError $mergeerror) {
$this->msg .= ' ' . $mergeerror->msg;
$this->word .= ' ' . $mergeerror->word;
if ($mergeerror->length > $this->length) {
$this->length = $mergeerror->length;
if (isset($mergeerror->suggs)) {
if (isset($this->suggs)) {
$this->suggs = array_merge($this->suggs,$mergeerror->suggs);
} else {
$this->suggs = $mergeerror->suggs;
* @return array
public function getSuggestions()
return $this->suggs;
* @return string
public function getMessage()
return $this->msg;
* @return int
public function getOffset()
return $this->offset;
public function getLength()
return $this->length;
public function getWord()
return $this->word;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: