I've been trying to learn PHP and I'm progressing pretty well at making my own blog engine. When it came time to integrate OAuth, I came across this solution to encrypt keys.
The usage says to do something along these lines:
<?php
// a new proCrypt instance
$crypt = new proCrypt;
// encrypt the string
$encoded = $crypt->encrypt( 'my message');
echo $encoded."\n";
// decrypt the string
echo $crypt->decrypt( $encoded ) . "\n";
?>
My question is... why is this a class? It seems like two functions would be just fine. I don't really get why I'd instantiate an object and then call some methods. Is this an example of OOP thinking run amok, or is there something I'm missing here?
If there is some compelling reason for it to be a class, why aren't the methods static so that I could just call proCrypt::encrypt( 'my message' );
?
This is relavent as a lot of the code I've written has been using static functions, or stand along functional programming instead of OOP. If I'm doing something horribly wrong, I'd like to know about it.