<?php
// Cole Class
namespace Marshall;
class Cole {
final public const string NAME_FIRST = 'Cole';
final public const string NAME_LAST = 'Marshall';
public function __construct(
public readonly string $profession = 'Web Developer & Designer',
public readonly array $specialties = [
'HTML', 'CSS', 'JavaScript', 'TypeScript', 'Vue.js',
'cross-browser compatibility', 'mobile/responsive design', 'search engine optimization',
'PHP', 'Node.js', 'MySQL', 'REST', 'XML', 'JSON', 'Git', 'automation',
'API development', 'cloud DevOps', 'IaC (Infrastructure as Code)', 'unit testing', 'end-to-end testing',
'Photoshop', 'Illustrator', 'After Effects', 'Graphic Design', 'Typography',
'User Interface (UI) Design', 'User Experience (UX) Design', 'Motion Graphics',
],
) {}
public function getFullName(): string {
return self::NAME_FIRST . ' ' . self::NAME_LAST;
}
public function getReadableDetails(): string {
$specialties = $this->specialties;
$finalSpecialty = array_pop($specialties);
$article = preg_match('/^[aeiou]/i', $this->profession) ? 'an' : 'a';
return sprintf(
'%s is %s %s who specializes in %s, and %s.',
$this->getFullName(),
$article,
$this->profession,
implode(', ', $specialties),
$finalSpecialty,
);
}
}
// Instantiate Cole
$cole = new Cole();
// Echo Cole's profession and specialties
echo $cole->getReadableDetails();
To embed this project on your website, copy the following code and paste it into your website's HTML: