public function check($data)
	{
		$failure  = 0;
		$messages = array();

		if (is_string($data))
		{
			$data = array('text' => $data);
		}

		$data = $this->prepareData($data);

		foreach ($this->detectors as $id => $detector)
		{
			$spam = false;
			$msg  = null;

			try
			{
				if ($detector->detect($data))
				{
					$spam = true;

					if ($detector->message())
					{
						$messages[] = $detector->message();
					}

					$failure++;
				}

				$msg = $detector->message();
			}
			catch (Exception $e)
			{
				$this->setError($e->getMessage());
			}

			$this->mark($id, $spam, $msg);
		}

		$result = new Result($failure > 0, $messages);

		return $result;
	}
public function check($data)
	{
		$failure  = 0;
		$messages = array();

		if (is_string($data))
		{
			$data = array('text' => $data);
		}

		$data = $this->prepareData($data);

		foreach ($this->detectors as $id => $detector)
		{
			$spam = false;
			$msg  = null;

			try
			{
				if ($detector->detect($data))
				{
					$spam = true;

					if ($detector->message())
					{
						$messages[] = $detector->message();
					}

					$failure++;
				}

				$msg = $detector->message();
			}
			catch (Exception $e)
			{
				$this->setError($e->getMessage());
			}

			$this->mark($id, $spam, $msg);
		}

		$result = new Result($failure > 0, $messages);

		return $result;
	}
public function check ( $ data ) { $ failure = 0 ; $ messages = array ( ) ; if ( is_string ( $ data ) ) { $ data = array ( 'text' => $ data ) ; } $ data = $ this -> prepareData ( $ data ) ; foreach ( $ this -> detectors as $ id => $ detector ) { $ spam = false ; $ msg = null ; try { if ( $ detector -> detect ( $ data ) ) { $ spam = true ; if ( $ detector -> message ( ) ) { $ messages [ ] = $ detector -> message ( ) ; } $ failure ++ ; } $ msg = $ detector -> message ( ) ; } catch ( Exception $ e ) { $ this -> setError ( $ e -> getMessage ( ) ) ; } $ this -> mark ( $ id , $ spam , $ msg ) ; } $ result = new Result ( $ failure > 0 , $ messages ) ; return $ result ; }
Checks if a string is spam or not

@param   string|array  $data
@return  object
Checks if a string is spam or not