Can someone please give me a run down of the Mcrypt Library and it's functions that are used below?

I followed a tutorial on creating a crypter class but the author was very vague if any explanation was give at all about how the Mcrypt Library works, and the reason for the mcrypt functions that were used.

PHP Code:
<?php
// Crypter Class

class Crypter{
    
    private 
$key;
    private 
$algo;
    
    public function 
__construct($key$algo MCRYPT_BLOWFISH){
        
$this->key substr($key0mcrypt_get_key_size($algoMCRYPT_MODE_ECB));
        
$this->algo $algo;
    }
    
    public function 
encrypt($data){
        
$iv_size mcrypt_get_iv_size($this->algoMCRYPT_MODE_ECB);
        
$iv mcrypt_create_iv($iv_sizeMCRYPT_RAND);
        
$crypt mcrypt_encrypt($this->algo$this->key$dataMCRYPT_MODE_ECB$iv);
        return 
trim(base64_encode($crypt));
    }
    
    public function 
decrypt($data){
        
$crypt base64_decode($data);
        
$iv_size mcrypt_get_iv_size($this->algoMCRYPT_MODE_ECB);
        
$iv mcrypt_create_iv($iv_sizeMCRYPT_RAND);
        
$decrypt mcrypt_decrypt($this->algo$this->key$cryptMCRYPT_MODE_ECB$iv);
        return 
trim($decrypt);
    }
}
?>