/**
  * @param array $params
  * @param $portionString
  * @return bool|int|string
  */
 private function findKeyParamByPortionString(array $params, $portionString)
 {
     foreach ($params as $key => $param) {
         $key = Text::getColumnLowerCase($key);
         $portionString = Text::getColumnLowerCase($portionString);
         if (preg_match('/^' . $key . '/', $portionString)) {
             return $key;
         }
     }
     return false;
 }
 public function testGetColumnLowerCase()
 {
     $expectedKey = 'lowerCase';
     foreach (self::$strings as $key => $expectedArray) {
         if ($key !== $expectedKey) {
             continue;
         }
         foreach ($expectedArray as $expectedValue => $string) {
             $result = Text::getColumnLowerCase($string);
             $this->assertEquals($result, $expectedValue, 'getColumnLowerCase returns expected value');
         }
     }
 }
 /**
  * @param Portion $portion
  * @return mixed
  */
 public static function truncateOperation(Portion $portion)
 {
     $operationKey = self::getSearchOperationKey($portion);
     if (!$operationKey) {
         return $portion->getPortion();
     }
     $operations = self::getOperations();
     $columnNameWithoutOperation = preg_replace($operations[$operationKey], "\$1", $portion->getPortion());
     return Text::getColumnLowerCase($columnNameWithoutOperation);
 }