Hi,
Right now I’m doing “simple cipher” in the php-track. I think I can make that work but the problem is that I’m passing almost all tests and I haven’t even filled in the functions yet. I’ve written an additional function and I see that as a start. I am NOT RETURNING a value from that function, on purpose, to break the tests but I’m not succeeding. When I do succeed, I can see some printed values. When a test passes, I cannot see anything, everything I print just isn’t there. I don’t know why I’m passing them and I don’t know why I’m not passing the first. I feel like I’m blind.
I also don’t enjoy being critical on a beautiful platform that exercism absolutely is. If I’ve done something silly, please tell me, if not, I would love to be a part of making this exercise work really well.
I’m adding the printed exercise as it is before I started working on it and what I’ve made of it. As you can see I’m returning no or nonsense values on purpose to break the tests. Maybe this post should be in another category? I don’t know. Btw, I’ve deleted my history because I’m working with the online editor. I tried installing locally but I’m in a fix because I did it in the past, changed a few bits, maybe I have to start all over again from scratch.
class SimpleCipher
{
public function __construct(string $key = null)
{
}
public function encode(string $plainText): string
{
}
public function decode(string $cipherText): string
{
}
}
class SimpleCipher
{
public function __construct(string $key = null)
{
$this->key = $key;
}
public function asciiKey() : int
{
$superKey = 0;
if(strlen($this->key) == 0) {
return random_int(65, 77);
}
$keyarr = str_split($this->key);
$ordinals = $keyarr.foreach($keyarr as $value) {
$superKey += ord($value);
}
//return $superKey; STILL PASSING THE TESTS!
}
public function encode(string $plainText): string
{
return "flupke";
}
public function decode(string $cipherText): string
{
return "flupke";
}
}