Skip to content

Instantly share code, notes, and snippets.

@ArchTaqi
Created September 7, 2024 11:49
Show Gist options
  • Save ArchTaqi/1cb702f9521228435b4567ff790fb79f to your computer and use it in GitHub Desktop.
Save ArchTaqi/1cb702f9521228435b4567ff790fb79f to your computer and use it in GitHub Desktop.
DRY PHP
<?php
function showDeveloperList(array $developers): void
{
foreach ($developers as $developer) {
$expectedSalary = $developer->calculateExpectedSalary();
$experience = $developer->getExperience();
$githubLink = $developer->getGithubLink();
$data = [$expectedSalary, $experience, $githubLink];
render($data);
}
}
function showManagerList(array $managers): void
{
foreach ($managers as $manager) {
$expectedSalary = $manager->calculateExpectedSalary();
$experience = $manager->getExperience();
$githubLink = $manager->getGithubLink();
$data = [$expectedSalary, $experience, $githubLink];
render($data);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment