protected function addText(EntityInterface $entity, AttributeInterface $attribute, array $options = array())
    {
        $min_length = $attribute->getOption('min_length');
        $max_length = $attribute->getOption('max_length');

        if ($this->shouldGuessByName($options)) {
            $value = TextGuesser::guess($attribute->getName(), $this->faker);
        }

        if (!isset($value)) {
            $value = $this->faker->words($this->faker->numberBetween(2, 10), true);
        }

        if ($min_length && ($len = mb_strlen($value)) < $min_length) {
            $repeat = ceil(($min_length - $len) / $len);
            $value .= str_repeat($value, $repeat);
        }

        if ($max_length && mb_strlen($value) > $max_length) {
            $value = substr($value, 0, $max_length);
            $value = preg_replace('#\s$#', 'o', $value);
        }

        $this->setValue($entity, $attribute, $value, $options);
    }
protected function addText(EntityInterface $entity, AttributeInterface $attribute, array $options = array())
    {
        $min_length = $attribute->getOption('min_length');
        $max_length = $attribute->getOption('max_length');

        if ($this->shouldGuessByName($options)) {
            $value = TextGuesser::guess($attribute->getName(), $this->faker);
        }

        if (!isset($value)) {
            $value = $this->faker->words($this->faker->numberBetween(2, 10), true);
        }

        if ($min_length && ($len = mb_strlen($value)) < $min_length) {
            $repeat = ceil(($min_length - $len) / $len);
            $value .= str_repeat($value, $repeat);
        }

        if ($max_length && mb_strlen($value) > $max_length) {
            $value = substr($value, 0, $max_length);
            $value = preg_replace('#\s$#', 'o', $value);
        }

        $this->setValue($entity, $attribute, $value, $options);
    }
protected function addText ( EntityInterface $ entity , AttributeInterface $ attribute , array $ options = array ( ) ) { $ min_length = $ attribute -> getOption ( 'min_length' ) ; $ max_length = $ attribute -> getOption ( 'max_length' ) ; if ( $ this -> shouldGuessByName ( $ options ) ) { $ value = TextGuesser :: guess ( $ attribute -> getName ( ) , $ this -> faker ) ; } if ( ! isset ( $ value ) ) { $ value = $ this -> faker -> words ( $ this -> faker -> numberBetween ( 2 , 10 ) , true ) ; } if ( $ min_length && ( $ len = mb_strlen ( $ value ) ) < $ min_length ) { $ repeat = ceil ( ( $ min_length - $ len ) / $ len ) ; $ value .= str_repeat ( $ value , $ repeat ) ; } if ( $ max_length && mb_strlen ( $ value ) > $ max_length ) { $ value = substr ( $ value , 0 , $ max_length ) ; $ value = preg_replace ( '#\s$#' , 'o' , $ value ) ; } $ this -> setValue ( $ entity , $ attribute , $ value , $ options ) ; }
Generates and adds fake data for a Text on a entity.

@param EntityInterface $entity an instance of the entity to fill with fake data.
@param AttributeInterface $attribute an instance of the Text to fill with fake data.
@param array $options array of options to customize fake data creation.

@return void
Generates and adds fake data for a Text on a entity .