public function findByName($name)
    {
        foreach ($this->exercises as $exercise) {
            if ($name === $exercise->getName()) {
                return $exercise;
            }
        }

        throw new InvalidArgumentException(sprintf('Exercise with name: "%s" does not exist', $name));
    }
public function findByName($name)
    {
        foreach ($this->exercises as $exercise) {
            if ($name === $exercise->getName()) {
                return $exercise;
            }
        }

        throw new InvalidArgumentException(sprintf('Exercise with name: "%s" does not exist', $name));
    }
public function findByName ( $ name ) { foreach ( $ this -> exercises as $ exercise ) { if ( $ name === $ exercise -> getName ( ) ) { return $ exercise ; } } throw new InvalidArgumentException ( sprintf ( 'Exercise with name: "%s" does not exist' , $ name ) ) ; }
Find an exercise by it's name. If it does not exist
an `InvalidArgumentException` exception is thrown.

@param string $name
@return ExerciseInterface
@throws InvalidArgumentException
Find an exercise by it s name . If it does not exist an InvalidArgumentException exception is thrown .